{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/unslothai/notebooks/blob/main/nb/OpenEnv_gpt_oss_(20B)_Reinforcement_Learning_2048_Game.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GtkTGCuh6QZy"
      },
      "source": [
        "# <img width=\"35\" height=\"35\" alt=\"image\" src=\"https://github.com/user-attachments/assets/2700a971-e5d6-4036-b03f-2f89c9791609\" /> OpenEnv: Agentic Execution Environments\n",
        "We're using the new [OpenEnv](https://github.com/meta-pytorch/OpenEnv) library which has over 2000+ environments for RL!\n",
        "\n",
        "To run this, press \"*Runtime*\" and press \"*Run all*\" on a **free** Tesla T4 Google Colab instance!\n",
        "<div class=\"align-center\">\n",
        "<a href=\"https://unsloth.ai/\"><img src=\"https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png\" width=\"115\"></a>\n",
        "<a href=\"https://discord.gg/unsloth\"><img src=\"https://github.com/unslothai/unsloth/raw/main/images/Discord button.png\" width=\"145\"></a>\n",
        "<a href=\"https://docs.unsloth.ai/\"><img src=\"https://github.com/unslothai/unsloth/blob/main/images/documentation%20green%20button.png?raw=true\" width=\"125\"></a></a> Join Discord if you need help + ⭐ <i>Star us on <a href=\"https://github.com/unslothai/unsloth\">Github</a> </i> ⭐\n",
        "</div>\n",
        "\n",
        "To install Unsloth your local device, follow [our guide](https://docs.unsloth.ai/get-started/install-and-update)."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "hzPgFeIkZn9q"
      },
      "source": [
        "# Goal: Make gpt-oss play games with Reinforcement Learning\n",
        "\n",
        "Our goal is to make OpenAI's open model gpt-oss 20b play the 2048 game with reinforcement learning. We want the model to devise a strategy to play 2048, and we will run this strategy until we win or lose.\n",
        "\n",
        "<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/2048_win.png/500px-2048_win.png\" height=300 />"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "31KIMLJLnHET"
      },
      "source": [
        "# Installation\n",
        "We'll be using [Unsloth](https://github.com/unslothai/unsloth) to do RL on GPT-OSS 20B, and [OpenEnv](https://github.com/meta-pytorch/OpenEnv) for the environment interactions. Unsloth saves 70% VRAM usage and makes reinforcement learning 2 to 6x faster!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "CGoDZwcunHEU"
      },
      "outputs": [],
      "source": [
        "%%capture\n",
        "import os, importlib.util\n",
        "!pip install --upgrade -qqq uv\n",
        "if importlib.util.find_spec(\"torch\") is None or \"COLAB_\" in \"\".join(os.environ.keys()):\n",
        "    try: import numpy; get_numpy = f\"numpy=={numpy.__version__}\"\n",
        "    except: get_numpy = \"numpy\"\n",
        "    !uv pip install -qqq \\\n",
        "        \"torch>=2.8.0\" \"triton>=3.4.0\" {get_numpy} torchvision bitsandbytes \"transformers==4.56.2\" trackio \\\n",
        "        \"unsloth_zoo[base] @ git+https://github.com/unslothai/unsloth-zoo\" \\\n",
        "        \"unsloth[base] @ git+https://github.com/unslothai/unsloth\" \\\n",
        "        git+https://github.com/triton-lang/triton.git@05b2c186c1b6c9a08375389d5efe9cb4c401c075#subdirectory=python/triton_kernels\n",
        "elif importlib.util.find_spec(\"unsloth\") is None:\n",
        "    !uv pip install -qqq unsloth trackio\n",
        "!uv pip install --upgrade --no-deps transformers==4.56.2 tokenizers trl==0.22.2 unsloth unsloth_zoo"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "OjifwNNZ7bMx"
      },
      "source": [
        "We will then install [OpenEnv](https://github.com/meta-pytorch/OpenEnv) from source:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "id": "1yzMMSLR7dNj"
      },
      "outputs": [],
      "source": [
        "%%capture\n",
        "!pip install -qqq fastapi uvicorn requests open_spiel\n",
        "!git clone https://github.com/meta-pytorch/OpenEnv.git > /dev/null 2>&1\n",
        "%cd OpenEnv\n",
        "import subprocess, sys, os\n",
        "from pathlib import Path\n",
        "sys.path.insert(0, './src')\n",
        "working_directory = str(Path.cwd().parent.absolute() / \"OpenEnv\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "CcLYwLyQLADE"
      },
      "source": [
        "We'll load GPT-OSS 20B and set some parameters:\n",
        "* `max_seq_length = 768` The maximum context length of the model. Increasing it will use more memory.\n",
        "* `lora_rank = 4` The larger this number, the smarter the RL process, but the slower and more memory usage`load_in_16bit` will be faster but will need a 64GB GPU or more (MI300)\n",
        "* `offload_embedding = True` New Unsloth optimization which moves the embedding to CPU RAM, reducing VRAM by 1GB."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 543,
          "referenced_widgets": [
            "f322d842499341d59846362ca89b18d6",
            "266891f93a724881be4bc77a9c98f8fc",
            "7ace0fdc545e4092bc1309bbd667d895",
            "1909e4395f304d19acb118744cbc12e7",
            "336f7a348c3749f1ac3cce6a9925067b",
            "65896147f42d4c648becf2a9a1b1b573",
            "adf3ad3523c84b0dabe729f54020afba",
            "141fe656e7f6467ba8be61f8a9bd80aa",
            "037f9d5ec256422b985619beac4855ff",
            "4a3de13bfbb345cd97ff32e05cfd360d",
            "740bc9d417d0405e9488e0b4bd6f15b8",
            "8215a8d597454ca887a130a96e3c6d5f",
            "9c7e7d50f12446e0873220b038a4bedd",
            "a824463d8e224dbca6ac734ad8e55d00",
            "50353ef7dac5461eb8f74b3708576b8f",
            "9cc5e02c0ad348d29a9284a293a533b4",
            "c2a884b997b6465c8457c8b125157738",
            "6b0f702505c04bb0ac655ca283a9bdd3",
            "3c9b4de557634ed5a0a147349e82470f",
            "afc92eb8a97e4c95962993384b35f592",
            "ddd46638ff44402eb74eab249d2c37d4",
            "2097b70b61d04763b87a33cc003394e4",
            "6a74a22829ff4d648a13c2c3b09f15c4",
            "38db602bf1ec484e8d1d832e9005150e",
            "6c72f8b28db4477eb58aa18259a96c3e",
            "a743efb16d1a448b9e2125b55e6d808b",
            "6c43c1c6e4bd4bc8ab8b5c447e3bf931",
            "3525a328a00641aaa286e5c81af678af",
            "3a75acb2f4bf446a83ce4006e834fb3e",
            "a17c314789ba464da246eca7f85e8f58",
            "48bf838eaf97412a9ca17a159578e484",
            "e5a31377954540948291fe9ff03fc3c6",
            "8d98e3038f814fa186f0e12426337b01",
            "dc3cdbf2b85844539a06eda6e41c66a1",
            "6acfe0b8e2954b7092e63930c707bcc8",
            "4198c588a83b43f7ab77583558d9470f",
            "76fc413095fd4299829c3659134c67db",
            "ea07fa6289cc4264ad80d26818ae2037",
            "be4e6e6684ac4eeaa3beeac6962ff44f",
            "72252d0e1f6448c093d9463f2f63564e",
            "2f927841210e4184baa6d122b3cb80e8",
            "8996362fc4e049d7b211e0b3a25cd36f",
            "9224be8c224b4aec84aadd95ed2b5150",
            "06cb14329ff44d62be6a1ddbd48da2c4",
            "218406f5ab104351b20e9952d34ef701",
            "4cb488c380dd46d19646fd42d190d7f8",
            "3ffb1e8c956c4dbcaee1c90d6dc29b3e",
            "5d2419316fcb45d1b438a48641901619",
            "5c5eec94c9644c6787f6bb6747be9df5",
            "4e1667158f724141ad9be3c53ad43fb8",
            "b021c18f2fd24231aa5a1a62a49e3aab",
            "9731dfa03d0d443ea6063d479a8d00d3",
            "9ad24dc59428469ea1d9dad820002aa5",
            "c301875ed80f44f78677f4beebc9cefb",
            "08ab98428cf94bc994d1073849eb5bb5",
            "3f35fa2276b6452ca87794af6463015d",
            "d3d7f6ea2b144fc381b0f5f4872c6338",
            "2683f25f5efb429c8c9913d8112aaa00",
            "8f8c4fa0309e402e83ec1a1a95062cf6",
            "7d0e216389d04d3aa813908c855d0225",
            "92fe46b183984e2796c357d91d8e0e01",
            "bb97dbe7f71d49d388a198fb3696147b",
            "4fd818e7f1af491d871cce8ec87dbafc",
            "f056d940b468488683cb22da504807c1",
            "8bde15a7b89345029a1989d96c8e388d",
            "1e9cb7b8c80a4516a08ecb1ded2deb7b",
            "d4f53f36a67e4d83ab1a6cc87d9b26d8",
            "6dc5baafb6144ec99e75e3e1a47ec93d",
            "f11d42f6838b4d818e7f623efb8d0589",
            "3bf7450fc7504236941ef7898db9beed",
            "acc131af4ac3410a89c45337534ec1ad",
            "f5c675e9b55d4056bf2daa159107d0da",
            "90563513ff9c4fa798fba3d55efeb2b8",
            "318ee566fb36440dbb2a551727d44beb",
            "ccd03fbafedd407191b33eb7a300bd50",
            "ac8e889be4bd45ecb23c22d0fad40968",
            "89265b9fe9e3425080c2ab8d0beeceb7",
            "7ed42c80bb9b49d09afef1d7edf21573",
            "cb68856ae17a4ab383484c7eb3b03d59",
            "b775da85b3ff4ae4977a1502846e8915",
            "1d0815294fe746d98b827912b0fa822d",
            "6bfba7ea97874f89a69ec34f68ad7298",
            "7c2ccd8eb68d41deab9a859f20220f5f",
            "70c3435e99c14e1f9ba23c4e624ff8f1",
            "57440cc5e0b241e6b868c61fd8b2ecf3",
            "32a58966b6a74680a71af03191e74c18",
            "52d7bb595be74be7842aa7a62c6f8766",
            "f289a2160e5247b3b5488d01a23f68aa",
            "a8518669143043c1b8149aec4c902465",
            "b8e5416b0f724845807cace57e09ad39",
            "0273638b31e44fa6935796e4299979b1",
            "7525295f755e460d9298424eb62fc4e5",
            "9e284d7642134c759c79e3acfd12335e",
            "4f13f9417cd54a06a5b2bec9d12f51b5",
            "b002ae27c0d2450786703750e16643d8",
            "07515545bce84bbf96ce10b76e1bea7c",
            "2a21b5a390dc47019223a4542a86668c",
            "fba0e171099b4eda8f89e45a34d5d888",
            "ede9afd88e1a4a9b8fcd73e04bddf6c7",
            "347a34b97bbe4e3ba05182b534107645",
            "db9fe0be33a54c678ae4c9c2ecf97eee",
            "bcff078d112f46e4b1e94c035913e461",
            "83782e2b3773487da5e48c1c4726d770",
            "61821b87d18c4f3e938cf47935cf641e",
            "359596af0b1846b781e5db6b68cdad7d",
            "c9567139ab7d4c1bb3bb41bde0b8075d",
            "3e159d3079d64251b1eb001247660aab",
            "dcc0040b380347d89242290aeab94110",
            "cfeb7536c7de4b1eb7f231b1ec9d4ca3",
            "8aef0f331a334f45884428705c30ed04",
            "ab99a17c79194324ab98bb2c598e6f3d",
            "24a219884efa4e32ae025153dce6ea93",
            "5faae86c5c3e496f9027402d5e5e5222",
            "7c88bbc032c24cdaafd56bc37281d92f",
            "ab211ea896c04775af1e89bcef1353f7",
            "5fe8063ed6184e4ebeff9436d4bf33c0",
            "54af85d50fe040798220437760b34473",
            "0710cfef2f394ef989c7c42c99ab686a",
            "a6ac3458e86949788a6f6836334ecb8f",
            "35c48050669b4c569f5bcdb7319c9e05",
            "291825a818954e4390c4961c00bd0394"
          ]
        },
        "id": "DkIvEkIIkEyB",
        "outputId": "8ede41be-3eb5-424e-9ac0-d44acf3bb768"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.\n",
            "🦥 Unsloth Zoo will now patch everything to make training faster!\n",
            "==((====))==  Unsloth 2025.11.3: Fast Gpt_Oss patching. Transformers: 4.56.2.\n",
            "   \\\\   /|    Tesla T4. Num GPUs = 1. Max memory: 14.741 GB. Platform: Linux.\n",
            "O^O/ \\_/ \\    Torch: 2.9.0+cu126. CUDA: 7.5. CUDA Toolkit: 12.6. Triton: 3.5.0\n",
            "\\        /    Bfloat16 = FALSE. FA [Xformers = None. FA2 = False]\n",
            " \"-____-\"     Free license: http://github.com/unslothai/unsloth\n",
            "Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!\n",
            "Unsloth: Using float16 precision for gpt_oss won't work! Using float32.\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "model.safetensors.index.json: 0.00B [00:00, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "f322d842499341d59846362ca89b18d6"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "model-00001-of-00004.safetensors:   0%|          | 0.00/4.00G [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "8215a8d597454ca887a130a96e3c6d5f"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "model-00002-of-00004.safetensors:   0%|          | 0.00/4.00G [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "6a74a22829ff4d648a13c2c3b09f15c4"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "model-00003-of-00004.safetensors:   0%|          | 0.00/3.37G [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "dc3cdbf2b85844539a06eda6e41c66a1"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "model-00004-of-00004.safetensors:   0%|          | 0.00/1.16G [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "218406f5ab104351b20e9952d34ef701"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "Loading checkpoint shards:   0%|          | 0/4 [00:00<?, ?it/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "3f35fa2276b6452ca87794af6463015d"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "generation_config.json:   0%|          | 0.00/165 [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "d4f53f36a67e4d83ab1a6cc87d9b26d8"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Unsloth: Offloading embeddings to RAM to save 1.08 GB.\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "tokenizer_config.json: 0.00B [00:00, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "7ed42c80bb9b49d09afef1d7edf21573"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "tokenizer.json:   0%|          | 0.00/27.9M [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "a8518669143043c1b8149aec4c902465"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "special_tokens_map.json:   0%|          | 0.00/446 [00:00<?, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "347a34b97bbe4e3ba05182b534107645"
            }
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "chat_template.jinja: 0.00B [00:00, ?B/s]"
            ],
            "application/vnd.jupyter.widget-view+json": {
              "version_major": 2,
              "version_minor": 0,
              "model_id": "ab99a17c79194324ab98bb2c598e6f3d"
            }
          },
          "metadata": {}
        }
      ],
      "source": [
        "import os\n",
        "from unsloth import FastLanguageModel\n",
        "import torch\n",
        "max_seq_length = 768 # Can increase for longer RL output\n",
        "lora_rank = 4        # Larger rank = smarter, but slower\n",
        "model, tokenizer = FastLanguageModel.from_pretrained(\n",
        "    model_name = \"unsloth/gpt-oss-20b\",\n",
        "    load_in_4bit = True,\n",
        "    max_seq_length = max_seq_length,\n",
        "    offload_embedding = True, # Offload embeddings to save more VRAM\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "TfeUs-lQJDSq"
      },
      "source": [
        "To do efficient RL, we will use [LoRA](https://arxiv.org/abs/2106.09685), which allows us to only add 1 to 5% of extra weights to the model for finetuning purposes. This allows us to save memory usage by over 60%, and yet it retains good accuracy. Read Unsloth's [GPT-OSS RL Guide](https://docs.unsloth.ai/new/gpt-oss-reinforcement-learning) for more details."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8rGa-o3HJCo1",
        "outputId": "aa837dad-670f-45d1-9a21-d8fda6d6ccde"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Unsloth: Making `model.base_model.model.model` require gradients\n"
          ]
        }
      ],
      "source": [
        "model = FastLanguageModel.get_peft_model(\n",
        "    model,\n",
        "    r = lora_rank, # Choose any number > 0 ! Suggested 8, 16, 32, 64, 128\n",
        "    target_modules = [\n",
        "        \"q_proj\", \"k_proj\", \"v_proj\", \"o_proj\",\n",
        "        \"gate_proj\", \"up_proj\", \"down_proj\",\n",
        "    ],\n",
        "    lora_alpha = lora_rank*2, # *2 speeds up training\n",
        "    use_gradient_checkpointing = \"unsloth\", # Reduces memory usage\n",
        "    random_state = 3407,\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "N0QnO9_YJBOI"
      },
      "source": [
        "# 2048 game environment with OpenEnv\n",
        "\n",
        "We first launch an OpenEnv process and import it! This will allows us to see how the 2048 implementation looks like!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "id": "hQrG81XV87-7"
      },
      "outputs": [],
      "source": [
        "from envs.openspiel_env import OpenSpielEnv\n",
        "from envs.openspiel_env.models import OpenSpielAction, OpenSpielObservation"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-WT0Zu0IcN_r"
      },
      "source": [
        "We'll be using Unsloth's OpenEnv implementation and wrapping the `launch_openenv` with some setup arguments:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "id": "zBIye94T8djG"
      },
      "outputs": [],
      "source": [
        "global port\n",
        "global openenv_process\n",
        "port = 9000\n",
        "openenv_process = None\n",
        "server = \"envs.openspiel_env.server.app:app\"\n",
        "environment = {\n",
        "    **os.environ,\n",
        "    \"PYTHONPATH\": f\"{working_directory}/src\",\n",
        "    \"OPENSPIEL_GAME\": \"2048\",\n",
        "    \"OPENSPIEL_AGENT_PLAYER\": \"0\",\n",
        "    \"OPENSPIEL_OPPONENT_POLICY\": \"random\",\n",
        "}\n",
        "\n",
        "# Augment Unsloth's OpenEnv creation function\n",
        "import functools\n",
        "from unsloth import is_port_open, launch_openenv\n",
        "launch_openenv = functools.partial(\n",
        "    launch_openenv,\n",
        "    working_directory = working_directory,\n",
        "    server = server,\n",
        "    environment = environment,\n",
        "    openenv_class = OpenSpielEnv,\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "P3rMiKLl9Ro2"
      },
      "source": [
        "Let's see how the current 2048 game state looks like:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "uBPx0Hho9Xi1",
        "outputId": "b2d52c3c-1006-4592-d6d0-411d9bbfb68e"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Unsloth: Creating new OpenEnv process at port = 12724.....................\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "OpenSpielObservation(done=False, reward=None, metadata={}, info_state=[0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], legal_actions=[0, 1, 2, 3], game_phase='initial', current_player_id=0, opponent_last_action=None)"
            ]
          },
          "metadata": {},
          "execution_count": 8
        }
      ],
      "source": [
        "port, openenv_process = launch_openenv(port, openenv_process)\n",
        "result = openenv_process.reset()\n",
        "current_state = result.observation\n",
        "current_state"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "4Qz1tRVTAii8"
      },
      "source": [
        "First let's convert the state into a list of list of numbers!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "7PVeoKW2AmKr",
        "outputId": "c4b7f44f-dc5c-4233-a6c1-d51a67089b5d"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "([[0, 0, 0, 2], [0, 0, 2, 0], [0, 0, 0, 0], [0, 0, 0, 0]], 4)"
            ]
          },
          "metadata": {},
          "execution_count": 9
        }
      ],
      "source": [
        "import numpy as np\n",
        "def convert_to_board(current_state):\n",
        "    n = len(current_state.info_state)\n",
        "    size = int(np.sqrt(n))\n",
        "    board = np.array_split(np.array(current_state.info_state, dtype = int), size)\n",
        "    board = [x.tolist() for x in board]\n",
        "    return board, size\n",
        "convert_to_board(current_state)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "hCS56yu29dsG"
      },
      "source": [
        "We also want to pretty print the game board!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "cellView": "form",
        "id": "D9CI4jtgL5mw"
      },
      "outputs": [],
      "source": [
        "#@title (Collapsible) 2048 Game Renderer\n",
        "def render_board(obs, colors: bool = True, border: bool = True, dot_for_zero: bool = True) -> str:\n",
        "    \"\"\"\n",
        "    Pretty-print the board with colors that scale from 0 up to self.target.\n",
        "    Uses ANSI 256-color codes (works in most terminals). Set colors=False to disable.\n",
        "    \"\"\"\n",
        "    import math\n",
        "    b, size = convert_to_board(obs)\n",
        "    mx = max((max(row) for row in b), default=0)\n",
        "    cell_w = max(3, len(str(mx)))\n",
        "\n",
        "    RESET = \"\\x1b[0m\"\n",
        "\n",
        "    # A smooth-ish gradient from cool → warm\n",
        "    # (blue/cyan/green → yellow/orange/red). Tweak or expand as you like.\n",
        "    GRAD = [33, 39, 45, 51, 50, 49, 48, 47, 46, 82, 118, 154, 190, 226, 220, 214, 208, 202, 196]\n",
        "    ZERO_FG = 239  # dim gray\n",
        "\n",
        "    def color_code(v: int) -> str:\n",
        "        if not colors:\n",
        "            return \"\"\n",
        "        if v == 0:\n",
        "            return f\"\\x1b[38;5;{ZERO_FG}m\"\n",
        "        # Normalize by exponent relative to target: r in [0,1]\n",
        "        t = max(2, 2048)  # safety; avoid log2(1)\n",
        "        # Guard: if v is not a power of two or is <1, handle gracefully\n",
        "        try:\n",
        "            r = max(0.0, min(1.0, math.log2(v) / math.log2(t)))\n",
        "        except ValueError:\n",
        "            r = 0.0\n",
        "        idx = int(round(r * (len(GRAD) - 1)))\n",
        "        return f\"\\x1b[38;5;{GRAD[idx]}m\"\n",
        "\n",
        "    def fmt(v: int) -> str:\n",
        "        s = \".\" if (v == 0 and dot_for_zero) else str(v)\n",
        "        s = s.rjust(cell_w)\n",
        "        return color_code(v) + s + (RESET if colors else \"\")\n",
        "\n",
        "    def hline(left: str, mid: str, right: str) -> str:\n",
        "        return left + mid.join(\"─\" * cell_w for _ in range(size)) + right\n",
        "\n",
        "    rows = []\n",
        "    if border:\n",
        "        rows.append(hline(\"┌\", \"┬\", \"┐\"))\n",
        "    for r in range(size):\n",
        "        content = \"│\".join(fmt(v) for v in b[r])\n",
        "        rows.append((\"│\" + content + \"│\") if border else content)\n",
        "        if border:\n",
        "            rows.append(hline(\"└\" if r == size - 1 else \"├\",\n",
        "                            \"┴\" if r == size - 1 else \"┼\",\n",
        "                            \"┘\" if r == size - 1 else \"┤\"))\n",
        "    return \"\\n\".join(rows)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "DAJE2LUo9oRR",
        "outputId": "bebe0d8a-4951-4b1a-b1b4-f3264c4d878c"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n"
          ]
        }
      ],
      "source": [
        "print(render_board(current_state))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0AhUa4hW-Dji"
      },
      "source": [
        "We can see the `legal_actions` ie what you can take as `[0, 1, 2, 3]` Let's try doing the action `0`."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "b-gSgthFI_wq",
        "outputId": "2dce2437-f8d0-4ea6-b84e-f5d454b4dc15"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n"
          ]
        }
      ],
      "source": [
        "action = OpenSpielAction(action_id = 0, game_name = \"2048\")\n",
        "result = openenv_process.step(action)\n",
        "current_state = result.observation\n",
        "print(render_board(current_state))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "lPSNb8-A-iPn"
      },
      "source": [
        "So it looks like `0` is a move up action! Let's try `1`."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "IUel11Tc-oLB",
        "outputId": "5af972ea-46f8-41c5-b5c8-a876a74c0f9d"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;51m  4\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "└───┴───┴───┴───┘\n"
          ]
        }
      ],
      "source": [
        "action = OpenSpielAction(action_id = 1, game_name = \"2048\")\n",
        "result = openenv_process.step(action)\n",
        "current_state = result.observation\n",
        "print(render_board(current_state))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "nUlOshVe-qNL"
      },
      "source": [
        "`1` is a move right action. And `2`:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "XU09-KA3-sqs",
        "outputId": "f431959e-3ec4-4322-e38c-e3ab6b938e34"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;51m  4\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "└───┴───┴───┴───┘\n"
          ]
        }
      ],
      "source": [
        "action = OpenSpielAction(action_id = 2, game_name = \"2048\")\n",
        "result = openenv_process.step(action)\n",
        "current_state = result.observation\n",
        "print(render_board(current_state))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "X2r7Zqw9-u-d"
      },
      "source": [
        "`2` is a move down. And I guess `3` is just move left!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "pFgspqn6-zd2",
        "outputId": "31679c07-8867-4f54-a15e-97334aa34e1f"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;51m  4\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;51m  4\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "└───┴───┴───┴───┘\n"
          ]
        }
      ],
      "source": [
        "action = OpenSpielAction(action_id = 3, game_name = \"2048\")\n",
        "result = openenv_process.step(action)\n",
        "current_state = result.observation\n",
        "print(render_board(current_state))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "RJP4TsDq-2ft"
      },
      "source": [
        "We can also print the game status which indicates if no more moves are possible, and also the possible actions you can take!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "MEa2ngmrvfNm",
        "outputId": "de0e6073-4127-49b1-fc9c-cd8e857fd261"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "False\n",
            "[0, 1, 3]\n"
          ]
        }
      ],
      "source": [
        "print(current_state.done)\n",
        "print(current_state.legal_actions)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "VR6czU96cpxf"
      },
      "source": [
        "# RL Environment Setup\n",
        "\n",
        "We'll set up a function to accept some strategy that'll emit an action within `0123` and check the game state.\n",
        "\n",
        "We'll also add a timer to only execute the stratgegy for 2 seconds maximum, otherwise it might never terminate!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {
        "id": "tdgjnf-8z_kr"
      },
      "outputs": [],
      "source": [
        "from typing import Callable\n",
        "from unsloth import execute_with_time_limit\n",
        "import itertools\n",
        "\n",
        "def _execute_strategy(strategy, current_state : OpenSpielObservation):\n",
        "    assert callable(strategy)\n",
        "\n",
        "    steps = 0\n",
        "    total_reward = 0\n",
        "    while not current_state.done:\n",
        "        board, size = convert_to_board(current_state)\n",
        "        action = strategy(board)\n",
        "        try:\n",
        "            action = int(action)\n",
        "        except:\n",
        "            return steps, False\n",
        "        steps += 1\n",
        "        if type(action) is not int or action not in current_state.legal_actions:\n",
        "            return steps, max(itertools.chain.from_iterable(board)) == 2048\n",
        "\n",
        "        global port, openenv_process\n",
        "        port, openenv_process = launch_openenv(port, openenv_process)\n",
        "        action = OpenSpielAction(action_id = action, game_name = \"2048\")\n",
        "        result = openenv_process.step(action)\n",
        "        current_state = result.observation\n",
        "        if result.reward is not None:\n",
        "            total_reward += result.reward\n",
        "    return steps, max(itertools.chain.from_iterable(board)) == 2048\n",
        "\n",
        "@execute_with_time_limit(2)\n",
        "def execute_strategy(strategy : Callable, current_state : OpenSpielObservation):\n",
        "    return _execute_strategy(strategy, current_state)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ywh0HizI9ayE"
      },
      "source": [
        "Let's make a generic strategy to just hit `3`. We should expect this generic strategy to fail:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "5bkhqoZc0IO8",
        "outputId": "77be6ef8-535e-4945-8ebc-74921f56b9e3"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(3, False)"
            ]
          },
          "metadata": {},
          "execution_count": 18
        }
      ],
      "source": [
        "def always_move_left(board):\n",
        "    return 3\n",
        "\n",
        "# Reset OpenEnv to an initial state!\n",
        "port, openenv_process = launch_openenv(port, openenv_process)\n",
        "result = openenv_process.reset()\n",
        "current_state = result.observation\n",
        "try:\n",
        "    steps, if_done = execute_strategy(always_move_left, current_state)\n",
        "except TimeoutError as e:\n",
        "    print(f\"Timed out with error = {str(e)}\")\n",
        "\n",
        "steps, if_done"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "dkuHVdB09sgf"
      },
      "source": [
        "To allow longer strategies for GPT-OSS Reinforcement Learning, we shall allow a 5 second timer."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {
        "id": "SK-LfzsA9wbW"
      },
      "outputs": [],
      "source": [
        "@execute_with_time_limit(5)\n",
        "def execute_strategy(strategy : Callable, current_state : OpenSpielObservation):\n",
        "    return _execute_strategy(strategy, current_state)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "tRhLV_bZMYxy"
      },
      "source": [
        "# Code Execution\n",
        "\n",
        "To execute and create a new Python function, we first have to check if the function does not call other global variables or cheat. This is called `countering reward hacking` since we don't want the function to cheat.\n",
        "\n",
        "For example the below piece of code is fine, since it only imports Python level functions. We use `check_python_modules`:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "zz80kvg6M4BG",
        "outputId": "a57edf10-4576-435f-9026-3442b1987bbc"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Only Python imports? True\n",
            "{'stdlib': ['math', 'typing'], 'non_stdlib': [], 'relative_imports': 0}\n"
          ]
        }
      ],
      "source": [
        "from unsloth import check_python_modules\n",
        "\n",
        "sample = \"\"\"\n",
        "def strategy(board):\n",
        "    import math\n",
        "    from typing import Callable\n",
        "    return \"0\"\n",
        "\"\"\"\n",
        "ok, info = check_python_modules(sample)\n",
        "print(\"Only Python imports?\", ok)\n",
        "print(info)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "bZzVWgKQ-VIg"
      },
      "source": [
        "For the below piece of code, since we import `numpy`, we should not allow the execution:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Z89Jw1KB-Ux7",
        "outputId": "c0fbc65b-95e1-4a29-a701-e36829a36f27"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Only Python imports? False\n",
            "{'stdlib': [], 'non_stdlib': ['numpy'], 'relative_imports': 0}\n"
          ]
        }
      ],
      "source": [
        "sample = \"\"\"\n",
        "def strategy(board):\n",
        "    from numpy import matmul\n",
        "    return \"0\"\n",
        "\"\"\"\n",
        "ok, info = check_python_modules(sample)\n",
        "print(\"Only Python imports?\", ok)\n",
        "print(info)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "SDSrjOTLVyQm"
      },
      "source": [
        "We also disallow global variable access. We'll use Unsloth's `create_locked_down_function` function\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "GcmYAmohVqw2",
        "outputId": "80d0f6cc-77b7-43eb-c79f-5517b263c9d3"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "name 'np' is not defined\n"
          ]
        }
      ],
      "source": [
        "from unsloth import create_locked_down_function\n",
        "function = \"\"\"\n",
        "def import_numpy():\n",
        "    np.matmul\n",
        "    print(\"Success\")\n",
        "\"\"\"\n",
        "f = create_locked_down_function(function)\n",
        "try:\n",
        "    f()\n",
        "except Exception as e:\n",
        "    print(str(e))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "5tJKwLUgZsRq",
        "outputId": "f9da3d93-0a0e-4068-ad9b-01c5375fd92e"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "60\n"
          ]
        }
      ],
      "source": [
        "from unsloth import create_locked_down_function\n",
        "function = \"\"\"\n",
        "def add(a, b):\n",
        "    def adder(a):\n",
        "        return a + b\n",
        "    return adder(b) + b\n",
        "\"\"\"\n",
        "f = create_locked_down_function(function)\n",
        "try:\n",
        "    print(f(10, 20))\n",
        "except Exception as e:\n",
        "    print(str(e))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "8CzwCyXIPK04"
      },
      "source": [
        "# Data & RL task setup\n",
        "\n",
        "We now have to create a prompt to tell the model to create a strategy for the 2048 game. You can customize this to some other task for another RL task."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "B-2RRE4HMrQO",
        "outputId": "32eede16-a93c-481a-8000-6687b251f6a3"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Create a new short 2048 strategy using only native Python code.\n",
            "You are given a list of list of numbers for the current board state.\n",
            "Output one action for \"0\", \"1\", \"2\", \"3\" on what is the optimal next step.\n",
            "Output your new short function in backticks using the format below:\n",
            "```python\n",
            "def strategy(board):\n",
            "    return \"0\" # Example\n",
            "```\n",
            "All helper functions should be inside def strategy. Only output the short function `strategy`.\n"
          ]
        }
      ],
      "source": [
        "prompt = \"\"\"\n",
        "Create a new short 2048 strategy using only native Python code.\n",
        "You are given a list of list of numbers for the current board state.\n",
        "Output one action for \"0\", \"1\", \"2\", \"3\" on what is the optimal next step.\n",
        "Output your new short function in backticks using the format below:\n",
        "```python\n",
        "def strategy(board):\n",
        "    return \"0\" # Example\n",
        "```\n",
        "All helper functions should be inside def strategy. Only output the short function `strategy`.\n",
        "\"\"\".strip()\n",
        "print(prompt)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "MIdudFUodN4i"
      },
      "source": [
        "First, let's prompt GPT-OSS without RL and see how it goes:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "9HJxrS76h3Ds",
        "outputId": "f19e55f8-bcb8-4428-8930-1f6fca0f55e1"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "<|start|>system<|message|>You are ChatGPT, a large language model trained by OpenAI.\n",
            "Knowledge cutoff: 2024-06\n",
            "Current date: 2025-11-25\n",
            "\n",
            "Reasoning: low\n",
            "\n",
            "# Valid channels: analysis, commentary, final. Channel must be included for every message.\n",
            "Calls to these tools must go to the commentary channel: 'functions'.<|end|><|start|>user<|message|>Create a new short 2048 strategy using only native Python code.\n",
            "You are given a list of list of numbers for the current board state.\n",
            "Output one action for \"0\", \"1\", \"2\", \"3\" on what is the optimal next step.\n",
            "Output your new short function in backticks using the format below:\n",
            "```python\n",
            "def strategy(board):\n",
            "    return \"0\" # Example\n",
            "```\n",
            "All helper functions should be inside def strategy. Only output the short function `strategy`.<|end|><|start|>assistant<|channel|>analysis<|message|>We need to provide a short function. Probably simple heuristic: choose move with lowest collision? Use sum? Just a placeholder.<|end|><|start|>assistant<|channel|>final<|message|>```python\n",
            "def strategy(board):\n",
            "    scores = [0]*4\n",
            "    for move in range(4):\n",
            "        r = 0\n",
            "        for row in board:\n",
            "            for val in row:\n",
            "                r += val * (move==0 and 1 or move==1 and 1 or move==2 and 1 or move==3 and 1)\n",
            "        scores[move] = r\n",
            "    return str(scores.index(max(scores)))\n",
            "```\n",
            "<|return|>\n"
          ]
        }
      ],
      "source": [
        "text = tokenizer.apply_chat_template(\n",
        "    [{\"role\": \"user\", \"content\": prompt}],\n",
        "    tokenize = False,\n",
        "    add_generation_prompt = True,\n",
        "    reasoning_effort = \"low\",\n",
        ")\n",
        "\n",
        "from transformers import TextStreamer\n",
        "_ = model.generate(\n",
        "    **tokenizer(text, return_tensors = \"pt\").to(\"cuda\"),\n",
        "    temperature = 1.0,\n",
        "    max_new_tokens = 512,\n",
        "    streamer = TextStreamer(tokenizer, skip_prompt = False),\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "iknaWZNudTNq"
      },
      "source": [
        "# Reward functions\n",
        "\n",
        "We now design a `extract_function` function which simply extracts the function wrapped in 3 back ticks.\n",
        "\n",
        "And 3 reward functions:\n",
        "\n",
        "1. `function_works` which rewards the model if the strategy is a valid Python function.\n",
        "2. `no_cheating` which checks if the function imported other modules, and if it did, we penalize it.\n",
        "3. `strategy_succeeds` which checks if the game strategy actually succeeds in attaining 2048 after running the auto-generated strategy."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8JJGXKdJ-Zl_",
        "outputId": "278097c5-c36b-46e0-c815-dbe871eaed96"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "def strategy(board):\n",
            "    return \"0\" # Example\n"
          ]
        }
      ],
      "source": [
        "def extract_function(text):\n",
        "    if text.count(\"```\") >= 2:\n",
        "        first = text.find(\"```\") + 3\n",
        "        second = text.find(\"```\", first)\n",
        "        fx = text[first : second].strip()\n",
        "        fx = fx.removeprefix(\"python\\n\")\n",
        "        fx = fx[fx.find(\"def\"):]\n",
        "        if fx.startswith(\"def strategy(board):\"): return fx\n",
        "    return None\n",
        "print(extract_function(prompt))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "KLXEcf_HSJlI"
      },
      "source": [
        "Below is our `function_works` reward function which uses Python's `exec` but guarded by not allowing leakage of local and global variables. We can also use `check_python_modules` first to check if there are errors before even executing the function:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "h3-B0IIsS56S",
        "outputId": "41ad8a78-11e7-4bca-8f30-dc86cb5359da"
      },
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "(False,\n",
              " {'error': \"SyntaxError: expected '(' (<unknown>, line 1)\",\n",
              "  'stdlib': [],\n",
              "  'non_stdlib': [],\n",
              "  'relative_imports': 0})"
            ]
          },
          "metadata": {},
          "execution_count": 27
        }
      ],
      "source": [
        "ok, info = check_python_modules(\"def a\")\n",
        "ok, info"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 28,
      "metadata": {
        "id": "qgFNXORy-lpO"
      },
      "outputs": [],
      "source": [
        "def function_works(completions, **kwargs):\n",
        "    scores = []\n",
        "    for completion in completions:\n",
        "        score = 0\n",
        "        response = completion[0][\"content\"]\n",
        "        function = extract_function(response)\n",
        "        if function is not None:\n",
        "            ok, info = check_python_modules(function)\n",
        "        if function is None or \"error\" in info:\n",
        "            score = -2.0\n",
        "        else:\n",
        "            try:\n",
        "                new_strategy = create_locked_down_function(function)\n",
        "                score = 1.0\n",
        "            except:\n",
        "                score = -0.5\n",
        "        scores.append(score)\n",
        "    return scores"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Gf69i2WT-m4K"
      },
      "source": [
        "`no_cheating` checks if the function cheated since it might have imported Numpy or other functions:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 29,
      "metadata": {
        "id": "cUfHzCVx-nGK"
      },
      "outputs": [],
      "source": [
        "def no_cheating(completions, **kwargs):\n",
        "    scores = []\n",
        "    for completion in completions:\n",
        "        score = 0\n",
        "        response = completion[0][\"content\"]\n",
        "        function = extract_function(response)\n",
        "        if function is not None:\n",
        "            ok, info = check_python_modules(function)\n",
        "            scores.append(1.0 if ok else -20.0) # Penalize heavily!\n",
        "        else:\n",
        "            scores.append(-1.0) # Failed creating function\n",
        "    return scores"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "slnqWG3FTror"
      },
      "source": [
        "Next `strategy_succeeds` checks if the strategy actually allows the game to terminate. Imagine if the strategy simply returned \"0\" which would fail after a time limit of 10 seconds.\n",
        "\n",
        "We also add a global `PRINTER` to print out the strategy and board state."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 30,
      "metadata": {
        "id": "sNi129lYTpZ2"
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "global PRINTER\n",
        "PRINTER = 0\n",
        "def strategy_succeeds(completions, **kwargs):\n",
        "    global PRINTER\n",
        "    scores = []\n",
        "    for completion in completions:\n",
        "        printed = False\n",
        "        score = 0\n",
        "        response = completion[0][\"content\"]\n",
        "        function = extract_function(response)\n",
        "        if PRINTER % 5 == 0:\n",
        "            printed = True\n",
        "            print(function)\n",
        "        PRINTER += 1\n",
        "        if function is not None:\n",
        "            ok, info = check_python_modules(function)\n",
        "        if function is None or \"error\" in info:\n",
        "            scores.append(0)\n",
        "            continue\n",
        "        try:\n",
        "            new_strategy = create_locked_down_function(function)\n",
        "        except:\n",
        "            scores.append(0)\n",
        "            continue\n",
        "        try:\n",
        "            # Reset OpenEnv to an initial state!\n",
        "            global port, openenv_process\n",
        "            port, openenv_process = launch_openenv(port, openenv_process)\n",
        "            result = openenv_process.reset()\n",
        "            current_state = result.observation\n",
        "            steps, if_done = execute_strategy(new_strategy, current_state)\n",
        "            print(f\"Steps = {steps} If Done = {if_done}\")\n",
        "            if printed is False:\n",
        "                print(function)\n",
        "            print(render_board(current_state))\n",
        "            if if_done:\n",
        "                scores.append(20.0) # Success - massively reward!\n",
        "            else:\n",
        "                scores.append(2.0) # Failed but function works!\n",
        "        except TimeoutError as e:\n",
        "            print(\"Timeout\")\n",
        "            scores.append(-1.0) # Failed with timeout\n",
        "        except Exception as e:\n",
        "            print(f\"Exception = {str(e)}\")\n",
        "            scores.append(-3.0) # Failed\n",
        "    return scores"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "TCpSxtvSeAG_"
      },
      "source": [
        "We'll now create the dataset which includes a replica of our prompt. Remember to add a reasoning effort of low! You can choose high reasoning mode, but this'll only work on more memory GPUs like MI300s."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 31,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Ldf6SjLHVPRv",
        "outputId": "d5fcfb19-cd38-4cf5-95a3-dc2517d35a05"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "181\n"
          ]
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "{'prompt': [{'content': 'Create a new short 2048 strategy using only native Python code.\\nYou are given a list of list of numbers for the current board state.\\nOutput one action for \"0\", \"1\", \"2\", \"3\" on what is the optimal next step.\\nOutput your new short function in backticks using the format below:\\n```python\\ndef strategy(board):\\n    return \"0\" # Example\\n```\\nAll helper functions should be inside def strategy. Only output the short function `strategy`.',\n",
              "   'role': 'user'}],\n",
              " 'answer': 0,\n",
              " 'reasoning_effort': 'low'}"
            ]
          },
          "metadata": {},
          "execution_count": 31
        }
      ],
      "source": [
        "from datasets import Dataset\n",
        "dataset = Dataset.from_list([{\"prompt\" : [{\"role\": \"user\", \"content\": prompt.strip()}], \"answer\" : 0, \"reasoning_effort\": \"low\"}]*1000)\n",
        "maximum_length = len(tokenizer.apply_chat_template([{\"role\": \"user\", \"content\": prompt.strip()}], add_generation_prompt = True))\n",
        "print(maximum_length)\n",
        "dataset[0]"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9-IOMhVg-2AM"
      },
      "source": [
        "<a name=\"Train\"></a>\n",
        "### Train the model\n",
        "\n",
        "Now set up GRPO Trainer and all configurations! We also support GSPO, GAPO, Dr GRPO and more! Go the Unsloth [Reinforcement Learning Docs](https://docs.unsloth.ai/get-started/reinforcement-learning-rl-guide) for more options.\n",
        "\n",
        "We're also using [TrackIO](https://github.com/gradio-app/trackio) which allows you to visualize all training metrics straight inside the notebook fully locally!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 32,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ptqkXK2D4d6p",
        "outputId": "6ffe061e-2194-4a34-8d39-f762a2502884"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Unsloth: We now expect `per_device_train_batch_size` * `gradient_accumulation_steps` * `world_size` to be a multiple of `num_generations`.\n",
            "We will change the batch size of 1 to the `num_generations` of 2\n"
          ]
        }
      ],
      "source": [
        "max_prompt_length = maximum_length + 1 # + 1 just in case!\n",
        "max_completion_length = max_seq_length - max_prompt_length\n",
        "\n",
        "from trl import GRPOConfig, GRPOTrainer\n",
        "training_args = GRPOConfig(\n",
        "    temperature = 1.0,\n",
        "    learning_rate = 2e-4,\n",
        "    weight_decay = 0.001,\n",
        "    warmup_ratio = 0.1,\n",
        "    lr_scheduler_type = \"linear\",\n",
        "    optim = \"adamw_8bit\",\n",
        "    logging_steps = 1,\n",
        "    per_device_train_batch_size = 1,\n",
        "    gradient_accumulation_steps = 1, # Increase to 4 for smoother training\n",
        "    num_generations = 2, # Decrease if out of memory\n",
        "    max_prompt_length = max_prompt_length,\n",
        "    max_completion_length = max_completion_length,\n",
        "    # num_train_epochs = 1, # Set to 1 for a full training run\n",
        "    max_steps = 600,\n",
        "    save_steps = 100,\n",
        "    report_to = \"trackio\", # Can use Weights & Biases, TrackIO\n",
        "    output_dir = \"outputs\",\n",
        "\n",
        "    # For optional training + evaluation\n",
        "    # fp16_full_eval = True,\n",
        "    # per_device_eval_batch_size = 4,\n",
        "    # eval_accumulation_steps = 1,\n",
        "    # eval_strategy = \"steps\",\n",
        "    # eval_steps = 1,\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "r9Mv8UZO5hz-"
      },
      "source": [
        "And let's run the trainer! If you scroll up, you'll see a table of rewards. The goal is to see the `reward` column increase!\n",
        "\n",
        "You might have to wait 150 to 200 steps for any action. You'll probably get 0 reward for the first 100 steps. Please be patient!\n",
        "\n",
        "| Step | Training Loss | reward    | reward_std | completion_length | kl       |\n",
        "|------|---------------|-----------|------------|-------------------|----------|\n",
        "| 1    | 0.000000      | 0.125000  | 0.000000   | 200.000000        | 0.000000 |\n",
        "| 2    | 0.000000      | 0.072375  | 0.248112   | 200.000000        | 0.000000 |\n",
        "| 3    | 0.000000      | -0.079000 | 0.163776   | 182.500000        | 0.000005 |\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 33,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "vzOuSVCL_GA9",
        "outputId": "91011ca5-ea13-44f0-edc9-d1117de246ba"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Unsloth: Switching to float32 training since model cannot work with float16\n"
          ]
        }
      ],
      "source": [
        "# For optional training + evaluation\n",
        "# new_dataset = dataset.train_test_split(test_size = 0.01)\n",
        "\n",
        "trainer = GRPOTrainer(\n",
        "    model = model,\n",
        "    processing_class = tokenizer,\n",
        "    reward_funcs = [\n",
        "        function_works,\n",
        "        no_cheating,\n",
        "        strategy_succeeds,\n",
        "    ],\n",
        "    args = training_args,\n",
        "    train_dataset = dataset,\n",
        "\n",
        "    # For optional training + evaluation\n",
        "    # train_dataset = new_dataset[\"train\"],\n",
        "    # eval_dataset = new_dataset[\"test\"],\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "fQhtuwP4cf34"
      },
      "source": [
        "And let's train the model! **NOTE** This might be quite slow! 600 steps takes ~5 hours or longer.\n",
        "\n",
        "[TrackIO](https://github.com/gradio-app/trackio) might be a bit slow to load - wait 2 minutes until the graphs pop up!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 34,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "VGRxPdSCcfC3",
        "outputId": "3e049fd1-071c-46a4-9675-30ed800b048b"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "==((====))==  Unsloth - 2x faster free finetuning | Num GPUs used = 2\n",
            "   \\\\   /|    Num examples = 1,000 | Num Epochs = 1 | Total steps = 600\n",
            "O^O/ \\_/ \\    Batch size per device = 2 | Gradient accumulation steps = 1\n",
            "\\        /    Data Parallel GPUs = 1 | Total batch size (2 x 1 x 1) = 2\n",
            " \"-____-\"     Trainable parameters = 1,990,656 of 20,916,747,840 (0.01% trained)\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "* Running on public URL: https://93f7f59fd9e1813cea.gradio.live\n",
            "* Trackio project initialized: huggingface\n",
            "* Trackio metrics logged to: /root/.cache/huggingface/trackio\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "* Created new run: dainty-sunset-0\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "`generation_config` default values have been modified to match model-specific defaults: {'max_length': 131072}. If this is not desired, please set these values explicitly.\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "def strategy(board):\n",
            "    # Simulate each move and choose one maximizing the largest tile after the move\n",
            "    moves = [\"0\", \"1\", \"2\", \"3\"]  # 0:left, 1:right, 2:up, 3:down\n",
            "    best_move, best_max = None, -1\n",
            "    \n",
            "    for m in moves:\n",
            "        nxt = [row[:] for row in board]\n",
            "        if m == \"0\":\n",
            "            for row in nxt:\n",
            "                l = [x for x in row if x]\n",
            "                l += [0]*(4-len(l))\n",
            "                for i in range(4):\n",
            "                    row[i] = l[i]\n",
            "        elif m == \"1\":\n",
            "            for row in nxt:\n",
            "                r = [x for x in row if x][::-1]\n",
            "                r += [0]*(4-len(r))\n",
            "                for i in range(4):\n",
            "                    row[i] = r[::-1][i]\n",
            "        elif m == \"2\":\n",
            "            cols = list(zip(*nxt))\n",
            "            for i, col in enumerate(cols):\n",
            "                l = [x for x in col if x]\n",
            "                l += [0]*(4-len(l))\n",
            "                for j in range(4):\n",
            "                    nxt[j][i] = l[j]\n",
            "        else:  # m == \"3\"\n",
            "            cols = list(zip(*nxt))\n",
            "            for i, col in enumerate(cols):\n",
            "                r = [x for x in col if x][::-1]\n",
            "                r += [0]*(4-len(r))\n",
            "                for j in range(4):\n",
            "                    nxt[j][i] = r[::-1][j]\n",
            "        max_tile = max(max(row) for row in nxt)\n",
            "        if max_tile > best_max:\n",
            "            best_max, best_move = max_tile, m\n",
            "    return best_move\n",
            "Steps = 1 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 13 If Done = False\n",
            "def strategy(board):\n",
            "    # simulate a move in the given direction and return new board\n",
            "    def move(b, d):\n",
            "        w, h = len(b), len(b[0])\n",
            "        res = [[0]*h for _ in range(w)]\n",
            "        for i in range(w):\n",
            "            line = [b[i][j] for j in range(h) if b[i][j]]\n",
            "            if d == 1: line = line[::-1]\n",
            "            merged = []\n",
            "            skip = False\n",
            "            for k in range(len(line)):\n",
            "                if skip:\n",
            "                    skip = False\n",
            "                    continue\n",
            "                if k+1 < len(line) and line[k]==line[k+1]:\n",
            "                    merged.append(line[k]*2)\n",
            "                    skip = True\n",
            "                else:\n",
            "                    merged.append(line[k])\n",
            "            if d == 1: merged = merged[::-1]\n",
            "            for j in range(len(merged)):\n",
            "                res[i][j] = merged[j]\n",
            "        return res\n",
            "\n",
            "    # evaluate a board by its total sum\n",
            "    def score(b):\n",
            "        return sum(sum(row) for row in b)\n",
            "\n",
            "    best_dir = None\n",
            "    best_score = -1\n",
            "    for d in range(4):\n",
            "        new_board = move(board, d)\n",
            "        s = score(new_board)\n",
            "        if s > best_score:\n",
            "            best_score = s\n",
            "            best_dir = str(d)\n",
            "    return best_dir\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Unsloth: Will smartly offload gradients to save VRAM!\n"
          ]
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ],
            "text/html": [
              "\n",
              "    <div>\n",
              "      \n",
              "      <progress value='31' max='600' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
              "      [ 31/600 2:49:09 < 55:19:03, 0.00 it/s, Epoch 0.03/1]\n",
              "    </div>\n",
              "    <table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              " <tr style=\"text-align: left;\">\n",
              "      <th>Step</th>\n",
              "      <th>Training Loss</th>\n",
              "      <th>reward</th>\n",
              "      <th>reward_std</th>\n",
              "      <th>completions / mean_length</th>\n",
              "      <th>completions / min_length</th>\n",
              "      <th>completions / max_length</th>\n",
              "      <th>completions / clipped_ratio</th>\n",
              "      <th>completions / mean_terminated_length</th>\n",
              "      <th>completions / min_terminated_length</th>\n",
              "      <th>completions / max_terminated_length</th>\n",
              "      <th>kl</th>\n",
              "      <th>rewards / function_works / mean</th>\n",
              "      <th>rewards / function_works / std</th>\n",
              "      <th>rewards / no_cheating / mean</th>\n",
              "      <th>rewards / no_cheating / std</th>\n",
              "      <th>rewards / strategy_succeeds / mean</th>\n",
              "      <th>rewards / strategy_succeeds / std</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <td>1</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>431.500000</td>\n",
              "      <td>407.000000</td>\n",
              "      <td>456.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>431.500000</td>\n",
              "      <td>407.000000</td>\n",
              "      <td>456.000000</td>\n",
              "      <td>0.000043</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>2</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-2.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>518.500000</td>\n",
              "      <td>451.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>451.000000</td>\n",
              "      <td>451.000000</td>\n",
              "      <td>451.000000</td>\n",
              "      <td>0.000360</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>-1.500000</td>\n",
              "      <td>2.121320</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>3</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>446.500000</td>\n",
              "      <td>307.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>307.000000</td>\n",
              "      <td>307.000000</td>\n",
              "      <td>307.000000</td>\n",
              "      <td>0.000699</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>4</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>555.000000</td>\n",
              "      <td>524.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>524.000000</td>\n",
              "      <td>524.000000</td>\n",
              "      <td>524.000000</td>\n",
              "      <td>0.000376</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>5</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>200.000000</td>\n",
              "      <td>92.000000</td>\n",
              "      <td>308.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>200.000000</td>\n",
              "      <td>92.000000</td>\n",
              "      <td>308.000000</td>\n",
              "      <td>0.002642</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>6</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>494.500000</td>\n",
              "      <td>403.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>403.000000</td>\n",
              "      <td>403.000000</td>\n",
              "      <td>403.000000</td>\n",
              "      <td>0.003704</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>7</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-1.250000</td>\n",
              "      <td>2.474874</td>\n",
              "      <td>556.000000</td>\n",
              "      <td>526.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>526.000000</td>\n",
              "      <td>526.000000</td>\n",
              "      <td>526.000000</td>\n",
              "      <td>0.003168</td>\n",
              "      <td>-1.250000</td>\n",
              "      <td>1.060660</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>8</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-2.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>516.000000</td>\n",
              "      <td>446.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>446.000000</td>\n",
              "      <td>446.000000</td>\n",
              "      <td>446.000000</td>\n",
              "      <td>0.025609</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>-1.500000</td>\n",
              "      <td>2.121320</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>9</td>\n",
              "      <td>0.000100</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>371.500000</td>\n",
              "      <td>254.000000</td>\n",
              "      <td>489.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>371.500000</td>\n",
              "      <td>254.000000</td>\n",
              "      <td>489.000000</td>\n",
              "      <td>0.113482</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>10</td>\n",
              "      <td>0.000200</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>463.500000</td>\n",
              "      <td>341.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>341.000000</td>\n",
              "      <td>341.000000</td>\n",
              "      <td>341.000000</td>\n",
              "      <td>0.156487</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>11</td>\n",
              "      <td>0.000100</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>258.500000</td>\n",
              "      <td>231.000000</td>\n",
              "      <td>286.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>258.500000</td>\n",
              "      <td>231.000000</td>\n",
              "      <td>286.000000</td>\n",
              "      <td>0.086097</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>12</td>\n",
              "      <td>0.000500</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>401.500000</td>\n",
              "      <td>240.000000</td>\n",
              "      <td>563.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>401.500000</td>\n",
              "      <td>240.000000</td>\n",
              "      <td>563.000000</td>\n",
              "      <td>0.469602</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>13</td>\n",
              "      <td>0.000300</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>509.000000</td>\n",
              "      <td>432.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>432.000000</td>\n",
              "      <td>432.000000</td>\n",
              "      <td>432.000000</td>\n",
              "      <td>0.264963</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>14</td>\n",
              "      <td>0.000500</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>391.500000</td>\n",
              "      <td>296.000000</td>\n",
              "      <td>487.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>391.500000</td>\n",
              "      <td>296.000000</td>\n",
              "      <td>487.000000</td>\n",
              "      <td>0.488018</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>15</td>\n",
              "      <td>0.000200</td>\n",
              "      <td>2.250000</td>\n",
              "      <td>2.474874</td>\n",
              "      <td>391.500000</td>\n",
              "      <td>358.000000</td>\n",
              "      <td>425.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>391.500000</td>\n",
              "      <td>358.000000</td>\n",
              "      <td>425.000000</td>\n",
              "      <td>0.220820</td>\n",
              "      <td>0.250000</td>\n",
              "      <td>1.060660</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>16</td>\n",
              "      <td>0.000700</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>467.500000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>0.736897</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>17</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-3.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.001540</td>\n",
              "      <td>-2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>18</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-3.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000859</td>\n",
              "      <td>-2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>19</td>\n",
              "      <td>0.000900</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>467.500000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>349.000000</td>\n",
              "      <td>0.936286</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>20</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-3.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.001194</td>\n",
              "      <td>-2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>21</td>\n",
              "      <td>0.000700</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>228.500000</td>\n",
              "      <td>187.000000</td>\n",
              "      <td>270.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>228.500000</td>\n",
              "      <td>187.000000</td>\n",
              "      <td>270.000000</td>\n",
              "      <td>0.661747</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>22</td>\n",
              "      <td>0.000600</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>419.500000</td>\n",
              "      <td>356.000000</td>\n",
              "      <td>483.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>419.500000</td>\n",
              "      <td>356.000000</td>\n",
              "      <td>483.000000</td>\n",
              "      <td>0.572173</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>23</td>\n",
              "      <td>0.000500</td>\n",
              "      <td>1.500000</td>\n",
              "      <td>3.535534</td>\n",
              "      <td>471.000000</td>\n",
              "      <td>416.000000</td>\n",
              "      <td>526.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>471.000000</td>\n",
              "      <td>416.000000</td>\n",
              "      <td>526.000000</td>\n",
              "      <td>0.484463</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>3.535534</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>24</td>\n",
              "      <td>0.001100</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>393.500000</td>\n",
              "      <td>269.000000</td>\n",
              "      <td>518.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>393.500000</td>\n",
              "      <td>269.000000</td>\n",
              "      <td>518.000000</td>\n",
              "      <td>1.106612</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>25</td>\n",
              "      <td>0.001300</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>414.500000</td>\n",
              "      <td>243.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>243.000000</td>\n",
              "      <td>243.000000</td>\n",
              "      <td>243.000000</td>\n",
              "      <td>1.276439</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>26</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-3.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.004636</td>\n",
              "      <td>-2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>-1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>27</td>\n",
              "      <td>0.001900</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>229.500000</td>\n",
              "      <td>99.000000</td>\n",
              "      <td>360.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>229.500000</td>\n",
              "      <td>99.000000</td>\n",
              "      <td>360.000000</td>\n",
              "      <td>1.933423</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>28</td>\n",
              "      <td>0.001700</td>\n",
              "      <td>4.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>340.000000</td>\n",
              "      <td>170.000000</td>\n",
              "      <td>510.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>340.000000</td>\n",
              "      <td>170.000000</td>\n",
              "      <td>510.000000</td>\n",
              "      <td>1.698163</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>2.000000</td>\n",
              "      <td>0.000000</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <td>29</td>\n",
              "      <td>0.001800</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>4.949748</td>\n",
              "      <td>367.000000</td>\n",
              "      <td>148.000000</td>\n",
              "      <td>586.000000</td>\n",
              "      <td>0.500000</td>\n",
              "      <td>148.000000</td>\n",
              "      <td>148.000000</td>\n",
              "      <td>148.000000</td>\n",
              "      <td>1.774722</td>\n",
              "      <td>-0.500000</td>\n",
              "      <td>2.121320</td>\n",
              "      <td>0.000000</td>\n",
              "      <td>1.414214</td>\n",
              "      <td>1.000000</td>\n",
              "      <td>1.414214</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table><p>"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Exception = list indices must be integers or slices, not list\n",
            "def strategy(board):\n",
            "    size=len(board)\n",
            "    def add_row(row):\n",
            "        return [x for x in row if x]\n",
            "    def compress(row):\n",
            "        row+=[0]*(size-len(row))\n",
            "        return row\n",
            "    def merge(row):\n",
            "        new=[]\n",
            "        skip=False\n",
            "        for i,x in enumerate(row):\n",
            "            if skip:\n",
            "                skip=False\n",
            "                continue\n",
            "            if i+1<len(row) and row[i]==row[i+1]:\n",
            "                new.append(x*2)\n",
            "                skip=True\n",
            "            else:\n",
            "                new.append(x)\n",
            "        return new\n",
            "    best, best_dir=None,None\n",
            "    for dir in \"0123\":\n",
            "        vec=[]\n",
            "        if dir==\"0\":\n",
            "            for r in board:vec+=add_row(r)\n",
            "        elif dir==\"1\":\n",
            "            for c in range(size):\n",
            "                vec+=add_row([board[r][c] for r in range(size)])\n",
            "        elif dir==\"2\":\n",
            "            for r in range(size):\n",
            "                vec+=add_row(board[size-1-r][::-1])\n",
            "        else:\n",
            "            for c in range(size):\n",
            "                vec+=add_row([board[r][c] for r in range(size-1,-1,-1)])\n",
            "        if vec:\n",
            "            new=merge(compress(vec))\n",
            "            score=sum(new)\n",
            "            if best is None or score>best:\n",
            "                best,best_dir=score,dir\n",
            "    return best_dir\n",
            "Steps = 2 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 3 If Done = False\n",
            "def strategy(board):\n",
            "    def move(board, dir):\n",
            "        n=len(board); m=n\n",
            "        def slide(line):\n",
            "            new=[x for x in line if x>0]\n",
            "            res=[]\n",
            "            i=0\n",
            "            while i<len(new):\n",
            "                if i+1<len(new) and new[i]==new[i+1]:\n",
            "                    res.append(new[i]*2)\n",
            "                    i+=2\n",
            "                else:\n",
            "                    res.append(new[i]); i+=1\n",
            "            result=res+[0]*(m-len(res))\n",
            "            return result\n",
            "        new=[[0]*m for _ in range(n)]\n",
            "        if dir==0: # up\n",
            "            for j in range(m):\n",
            "                col=[board[i][j] for i in range(n)]\n",
            "                new_col=slide(col)\n",
            "                for i in range(n): new[i][j]=new_col[i]\n",
            "        elif dir==1: # down\n",
            "            for j in range(m):\n",
            "                col=[board[i][j] for i in range(n)][::-1]\n",
            "                new_col=slide(col)\n",
            "                for i in range(n): new[n-1-i][j]=new_col[i]\n",
            "        elif dir==2: # left\n",
            "            for i in range(n):\n",
            "                new[i]=slide(board[i])\n",
            "        else: # right\n",
            "            for i in range(n):\n",
            "                rev=board[i][::-1]\n",
            "                new_rev=slide(rev)\n",
            "                new[i]=new_rev[::-1]\n",
            "        return new\n",
            "\n",
            "    def score(b):\n",
            "        s=0\n",
            "        for i in range(len(b)):\n",
            "            for j in range(len(b)):\n",
            "                s+=b[i][j]* (1 if (i+j)%2==0 else 0.5)\n",
            "        return s\n",
            "\n",
            "    best=0; bestS=score(move(board,best))\n",
            "    for d in [1,2,3]:\n",
            "        s=score(move(board,d))\n",
            "        if s>bestS:\n",
            "            bestS=s; best=d\n",
            "    return str(best)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 11 If Done = False\n",
            "def strategy(board):\n",
            "    # board is a 4x4 list of lists\n",
            "    # try to move to the best direction by evaluating a simple heuristic\n",
            "    def can_move(d):\n",
            "        b = board\n",
            "        for i in range(4):\n",
            "            for j in range(4):\n",
            "                val = b[i][j]\n",
            "                if val == 0:\n",
            "                    continue\n",
            "                if d == 0 and j > 0 and b[i][j-1] in (0, val):\n",
            "                    return True\n",
            "                if d == 1 and j < 3 and b[i][j+1] in (0, val):\n",
            "                    return True\n",
            "                if d == 2 and i > 0 and b[i-1][j] in (0, val):\n",
            "                    return True\n",
            "                if d == 3 and i < 3 and b[i+1][j] in (0, val):\n",
            "                    return True\n",
            "        return False\n",
            "\n",
            "    # Prefer moves that merge the largest tile or keep the board from splitting\n",
            "    best = None\n",
            "    for d in range(4):\n",
            "        if can_move(d):\n",
            "            best = d\n",
            "            break\n",
            "    return str(best if best is not None else 0)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 3 If Done = False\n",
            "def strategy(board):\n",
            "    # Simple heuristic: always move up if possible, else right\n",
            "    for i, row in enumerate(board):\n",
            "        if row[i] == 0:\n",
            "            return \"0\"  # move up\n",
            "    return \"3\"  # otherwise, move down\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    def move(b, dir):  # 0=up,1=down,2=left,3=right\n",
            "        size = len(b)\n",
            "        new, changed = [ [0]*size for _ in range(size) ], False\n",
            "        for i in range(size):\n",
            "            line = []\n",
            "            for j in range(size):\n",
            "                val = b[j][i] if dir==0 else b[j][i] if dir==1 else b[i][j] if dir==2 else b[i][j]\n",
            "                if val:\n",
            "                    line.append(val)\n",
            "            merged = []\n",
            "            k=0\n",
            "            while k < len(line):\n",
            "                if k+1 < len(line) and line[k]==line[k+1]:\n",
            "                    merged.append(line[k]*2); k+=2\n",
            "                else:\n",
            "                    merged.append(line[k]); k+=1\n",
            "            for k in range(len(merged)):\n",
            "                if dir==0:\n",
            "                    new[merged.index(merged[k])][i] = merged[k]\n",
            "                elif dir==1:\n",
            "                    new[size-1-merged.index(merged[k])][i] = merged[k]\n",
            "                elif dir==2:\n",
            "                    new[i][merged.index(merged[k])] = merged[k]\n",
            "                elif dir==3:\n",
            "                    new[i][size-1-merged.index(merged[k])] = merged[k]\n",
            "        return new\n",
            "    best, best_dir = 0, 0\n",
            "    for d in range(4):\n",
            "        moved = move(board, d)\n",
            "        score = sum(sum(row) for row in moved)\n",
            "        if score > best:\n",
            "            best, best_dir = score, d\n",
            "    return str(best_dir)\n",
            "Steps = 10 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Exception = list index out of range\n",
            "None\n",
            "Steps = 19 If Done = False\n",
            "def strategy(board):\n",
            "    # Board is 4x4 list of lists; 0 denotes empty\n",
            "    # Return direction: 0=up, 1=down, 2=left, 3=right\n",
            "    def weight(b):\n",
            "        w = 0\n",
            "        for i in range(4):\n",
            "            for j in range(4):\n",
            "                if b[i][j]:\n",
            "                    w += (b[i][j] == 2) * (i + j)\n",
            "        return w\n",
            "    best_dir = 0\n",
            "    best_w = -1\n",
            "    dirs = [(0,1,2,3)]  # dummy to avoid unused list\n",
            "    for d in [\"up\",\"down\",\"left\",\"right\"]:\n",
            "        new = board[::-1] if d==\"up\" else board\n",
            "        # simulate simple move\n",
            "        # (in practice would use a copy and slide logic)\n",
            "        if weight(new) > best_w:\n",
            "            best_w = weight(new)\n",
            "            best_dir = {\"up\":0,\"down\":1,\"left\":2,\"right\":3}[d]\n",
            "    return str(best_dir)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 11 If Done = False\n",
            "def strategy(board):\n",
            "    # Helper to simulate move and count merges\n",
            "    def slide(row):\n",
            "        new = [x for x in row if x]\n",
            "        i = 0\n",
            "        while i < len(new)-1:\n",
            "            if new[i]==new[i+1]:\n",
            "                new[i]*=2\n",
            "                del new[i+1]\n",
            "            i+=1\n",
            "        return new+[0]*(len(row)-len(new))\n",
            "\n",
            "    def can_move(b):\n",
            "        for r in range(4):\n",
            "            for c in range(4):\n",
            "                if board[r][c]==0: return True\n",
            "                if r<3 and board[r][c]==board[r+1][c]: return True\n",
            "                if c<3 and board[r][c]==board[r][c+1]: return True\n",
            "        return False\n",
            "\n",
            "    if not can_move(board): return \"0\"\n",
            "    best, best_score = -1, -1\n",
            "    for action in \"0123\":\n",
            "        new_board = [row[:] for row in board]\n",
            "        if action==\"0\":  # up\n",
            "            for c in range(4):\n",
            "                col = [new_board[r][c] for r in range(4)]\n",
            "                col = slide(col)\n",
            "                for r in range(4): new_board[r][c]=col[r]\n",
            "        elif action==\"1\":  # down\n",
            "            for c in range(4):\n",
            "                col = [new_board[r][c] for r in range(4)][::-1]\n",
            "                col = slide(col)\n",
            "                col = col[::-1]\n",
            "                for r in range(4): new_board[r][c]=col[r]\n",
            "        elif action==\"2\":  # left\n",
            "            for r in range(4):\n",
            "                new_board[r] = slide(new_board[r])\n",
            "        else:  # right\n",
            "            for r in range(4):\n",
            "                new_board[r] = slide(new_board[r][::-1])[::-1]\n",
            "        score = sum(sum(row) for row in new_board)\n",
            "        if score>best_score:\n",
            "            best_score=score; best=action\n",
            "    return best\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 4 If Done = False\n",
            "def strategy(board):\n",
            "    # Count empty tiles (0) for each direction\n",
            "    best_dir, best_score = None, -1\n",
            "    dirs = {'0': (0, -1), '1': (0, 1), '2': (-1, 0), '3': (1, 0)}\n",
            "    n = len(board)\n",
            "    for d, (dx, dy) in dirs.items():\n",
            "        # simulate move\n",
            "        temp = [[0]*n for _ in range(n)]\n",
            "        moved = False\n",
            "        for i in range(n):\n",
            "            for j in range(n):\n",
            "                val = board[i][j]\n",
            "                if val == 0: continue\n",
            "                x, y = i, j\n",
            "                while 0 <= x + dx < n and 0 <= y + dy < n and (temp[x+dx][y+dy] == 0 or temp[x+dx][y+dy] == val):\n",
            "                    if temp[x+dx][y+dy] == val:\n",
            "                        temp[x+dx][y+dy] *= 2\n",
            "                        moved = True\n",
            "                        break\n",
            "                    x += dx; y += dy\n",
            "                if not (0 <= x + dx < n and 0 <= y + dy < n) and not moved:\n",
            "                    temp[x][y] = val\n",
            "        # evaluate heuristic: fewer empty tiles after move\n",
            "        empty = sum(row.count(0) for row in temp)\n",
            "        if empty > best_score:\n",
            "            best_score = empty\n",
            "            best_dir = d\n",
            "    return best_dir\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;51m  4\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    # prioritize moves that merge tiles\n",
            "    best = 0\n",
            "    best_score = -1\n",
            "    for move in range(4):  # 0: up, 1: down, 2: left, 3: right\n",
            "        new_board = []\n",
            "        for row in board:\n",
            "            new_row = row[:]\n",
            "            # shift non-zero tiles\n",
            "            merged = []\n",
            "            for val in new_row:\n",
            "                if val != 0:\n",
            "                    merged.append(val)\n",
            "            merged += [0] * (len(row) - len(merged))\n",
            "            # merge adjacent equal values\n",
            "            i = 0\n",
            "            while i < len(merged) - 1:\n",
            "                if merged[i] == merged[i + 1] and merged[i] != 0:\n",
            "                    merged[i] += merged[i + 1]\n",
            "                    merged[i + 1] = 0\n",
            "                    i += 1\n",
            "                i += 1\n",
            "            new_row = merged\n",
            "            new_board.append(new_row)\n",
            "        # evaluate score: higher empty tiles = better\n",
            "        empties = sum(row.count(0) for row in new_board)\n",
            "        if empties > best_score:\n",
            "            best_score = empties\n",
            "            best = move\n",
            "    return str(best)\n",
            "Steps = 2 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 3 If Done = False\n",
            "def strategy(board):\n",
            "    # Quick heuristic: move right if possible, else down, else left, else up\n",
            "    rows, cols = len(board), len(board[0])\n",
            "    # check if can move right\n",
            "    for i in range(rows):\n",
            "        for j in range(cols-1):\n",
            "            if board[i][j] == 0 and board[i][j+1] == 0:\n",
            "                return \"0\"  # right\n",
            "    # down\n",
            "    for i in range(rows-1):\n",
            "        for j in range(cols):\n",
            "            if board[i][j] == 0 and board[i+1][j] == 0:\n",
            "                return \"1\"  # down\n",
            "    # left\n",
            "    for i in range(rows):\n",
            "        for j in range(1, cols):\n",
            "            if board[i][j] == 0 and board[i][j-1] == 0:\n",
            "                return \"2\"  # left\n",
            "    return \"3\"  # up\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;51m  4\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 2 If Done = False\n",
            "def strategy(board):\n",
            "    # board is a 2D list of ints, 0 means empty.\n",
            "    \n",
            "    def move(board, d):\n",
            "        # simulate moving all tiles in direction d (0=up,1=down,2=left,3=right)\n",
            "        n = len(board)\n",
            "        new_board = [[0]*n for _ in range(n)]\n",
            "        for i in range(n):\n",
            "            if d == 2 or d == 3:  # horizontal\n",
            "                line = board[i] if d == 2 else board[i][::-1]\n",
            "            else:  # vertical\n",
            "                line = [board[j][i] for j in range(n)]\n",
            "                if d == 3:  # right -> reverse\n",
            "                    line = line[::-1]\n",
            "\n",
            "            merged = []\n",
            "            prev = None\n",
            "            for v in line:\n",
            "                if v == 0: continue\n",
            "                if prev is None:\n",
            "                    prev = v\n",
            "                elif prev == v:\n",
            "                    merged.append(prev*2)\n",
            "                    prev = None\n",
            "                else:\n",
            "                    merged.append(prev)\n",
            "                    prev = v\n",
            "            if prev is not None:\n",
            "                merged.append(prev)\n",
            "\n",
            "            # pad with zeros\n",
            "            while len(merged) < n:\n",
            "                merged.append(0)\n",
            "            # write back\n",
            "            if d == 2 or d == 3:\n",
            "                new_board[i] = merged if d == 2 else merged[::-1]\n",
            "            else:\n",
            "                for j in range(n):\n",
            "                    new_board[j][i] = merged[j] if d == 0 else merged[::-1][j]\n",
            "        return new_board\n",
            "\n",
            "    best_dir = None\n",
            "    best_score = -1\n",
            "    for d in range(4):\n",
            "        new = move(board, d)\n",
            "        # simple score: sum of tiles\n",
            "        score = sum(sum(row) for row in new)\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best_dir = d\n",
            "    return str(best_dir)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 7 If Done = False\n",
            "def strategy(board):\n",
            "    moves = []\n",
            "    for i, row in enumerate(board):\n",
            "        for j, val in enumerate(row):\n",
            "            if val is None:\n",
            "                continue\n",
            "            moves.append((i, j, val))\n",
            "    # Simple heuristic: move the largest tile towards the top-left corner\n",
            "    best = None\n",
            "    best_score = -1\n",
            "    for m in moves:\n",
            "        # The score is the sum of the tile value and its distance from (0,0)\n",
            "        score = m[2] - (m[0] + m[1])\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best = str(m[1])  # use column index as action\n",
            "    if best is None:\n",
            "        return \"0\"\n",
            "    return best\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    import random\n",
            "    # try each move, keep the one with largest score (sum of tiles)\n",
            "    best = None\n",
            "    best_score = -1\n",
            "    for move in \"0123\":\n",
            "        b = [row[:] for row in board]\n",
            "        # apply move\n",
            "        def compress(row):\n",
            "            nonz = [x for x in row if x]\n",
            "            res = []\n",
            "            i=0\n",
            "            while i < len(nonz):\n",
            "                if i+1 < len(nonz) and nonz[i]==nonz[i+1]:\n",
            "                    res.append(nonz[i]*2); i+=2\n",
            "                else:\n",
            "                    res.append(nonz[i]); i+=1\n",
            "            return res + [0]*(len(row)-len(res))\n",
            "        if move==\"0\": # left\n",
            "            for r in b:\n",
            "                r[:]=compress(r)\n",
            "        elif move==\"1\": # down\n",
            "            for c in range(len(b[0])):\n",
            "                col=[b[r][c] for r in range(len(b))]\n",
            "                col=compress(col)\n",
            "                for r in range(len(b)):\n",
            "                    b[r][c]=col[r]\n",
            "        elif move==\"2\": # right\n",
            "            for r in b:\n",
            "                r[:] = compress(r[::-1])[::-1]\n",
            "        else: # up\n",
            "            for c in range(len(b[0])):\n",
            "                col=[b[r][c] for r in range(len(b))]\n",
            "                col=compress(col[::-1])[::-1]\n",
            "                for r in range(len(b)):\n",
            "                    b[r][c]=col[r]\n",
            "        score=sum(sum(row) for row in b)\n",
            "        if score>best_score:\n",
            "            best_score=score; best=move\n",
            "    return \"0\" if best is None else best\n",
            "Steps = 17 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 12 If Done = False\n",
            "def strategy(board):\n",
            "    # simple priority: if up possible, else left, else down, else right\n",
            "    def can(move):\n",
            "        if move == 0:  # up\n",
            "            for j in range(4):\n",
            "                for i in range(1,4):\n",
            "                    if board[i][j] and board[i-1][j] == 0: return True\n",
            "        elif move == 1:  # down\n",
            "            for j in range(4):\n",
            "                for i in range(3):\n",
            "                    if board[i][j] and board[i+1][j] == 0: return True\n",
            "        elif move == 2:  # left\n",
            "            for i in range(4):\n",
            "                for j in range(1,4):\n",
            "                    if board[i][j] and board[i][j-1] == 0: return True\n",
            "        elif move == 3:  # right\n",
            "            for i in range(4):\n",
            "                for j in range(3):\n",
            "                    if board[i][j] and board[i][j+1] == 0: return True\n",
            "        return False\n",
            "    for m in range(4):\n",
            "        if can(m): return str(m)\n",
            "    return \"0\"\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 6 If Done = False\n",
            "def strategy(board):\n",
            "    # board: list of 4 lists, each with 4 ints\n",
            "    moves = []\n",
            "    # simulate a move by sliding\n",
            "    def slide(b, dir):\n",
            "        result = [[0]*4 for _ in range(4)]\n",
            "        for i in range(4):\n",
            "            line = []\n",
            "            for j in range(4):\n",
            "                if dir == 0:  # up\n",
            "                    val = b[j][i]\n",
            "                elif dir == 1:  # left\n",
            "                    val = b[i][j]\n",
            "                elif dir == 2:  # down\n",
            "                    val = b[3-j][i]\n",
            "                else:  # right\n",
            "                    val = b[i][3-j]\n",
            "                if val: line.append(val)\n",
            "            if not line: \n",
            "                return None\n",
            "            merged = []\n",
            "            skip = False\n",
            "            for k in range(len(line)):\n",
            "                if skip: \n",
            "                    skip = False\n",
            "                    continue\n",
            "                if k+1 < len(line) and line[k]==line[k+1]:\n",
            "                    merged.append(line[k]*2)\n",
            "                    skip = True\n",
            "                else:\n",
            "                    merged.append(line[k])\n",
            "            # pad with zeros\n",
            "            merged += [0]*(4-len(merged))\n",
            "            # place back\n",
            "            for j in range(4):\n",
            "                if dir == 0:\n",
            "                    result[j][i] = merged[j]\n",
            "                elif dir == 1:\n",
            "                    result[i][j] = merged[j]\n",
            "                elif dir == 2:\n",
            "                    result[3-j][i] = merged[j]\n",
            "                else:\n",
            "                    result[i][3-j] = merged[j]\n",
            "        return result\n",
            "\n",
            "    best_score = -1\n",
            "    best_dir = 0\n",
            "    for d in range(4):\n",
            "        new_board = slide(board, d)\n",
            "        if new_board is None:\n",
            "            continue\n",
            "        # heuristic: sum of squares, encouraging high values\n",
            "        score = sum(sum(v*v for v in row) for row in new_board)\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best_dir = d\n",
            "    return str(best_dir)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 8 If Done = False\n",
            "def strategy(board):\n",
            "    # Calculate scores for each direction based on simple heuristic\n",
            "    def score_move(dx, dy):\n",
            "        new_board = [[0]*4 for _ in range(4)]\n",
            "        for i in range(4):\n",
            "            for j in range(4):\n",
            "                val = board[i][j]\n",
            "                if val == 0:\n",
            "                    continue\n",
            "                x, y = i, j\n",
            "                while True:\n",
            "                    nx, ny = x+dx, y+dy\n",
            "                    if 0 <= nx < 4 and 0 <= ny < 4:\n",
            "                        if board[nx][ny] == 0 or board[nx][ny] == val:\n",
            "                            x, y = nx, ny\n",
            "                            if board[nx][ny] == val:\n",
            "                                val *= 2\n",
            "                        else:\n",
            "                            break\n",
            "                    else:\n",
            "                        break\n",
            "                new_board[x][y] = val\n",
            "        # Heuristic: prefer moves that do not increase empty tiles\n",
            "        empty = sum(1 for i in range(4) for j in range(4) if new_board[i][j] == 0)\n",
            "        return empty\n",
            "\n",
            "    moves = [(0, -1), (1, 0), (0, 1), (-1, 0)]  # Up, Right, Down, Left\n",
            "    scores = [score_move(dx, dy) for dx, dy in moves]\n",
            "    best = min(range(4), key=lambda i: scores[i])  # choose move with fewest empty tiles\n",
            "    return str(best)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    # Find any move that merges or moves a tile\n",
            "    def can_move(board, dir):\n",
            "        n = len(board)\n",
            "        if dir == 0:  # up\n",
            "            for j in range(n):\n",
            "                prev = -1\n",
            "                for i in range(n):\n",
            "                    v = board[i][j]\n",
            "                    if v == 0: continue\n",
            "                    if v == prev: return True\n",
            "                    prev = v\n",
            "        if dir == 1:  # down\n",
            "            for j in range(n):\n",
            "                prev = -1\n",
            "                for i in range(n-1, -1, -1):\n",
            "                    v = board[i][j]\n",
            "                    if v == 0: continue\n",
            "                    if v == prev: return True\n",
            "                    prev = v\n",
            "        if dir == 2:  # left\n",
            "            for i in range(n):\n",
            "                prev = -1\n",
            "                for j in range(n):\n",
            "                    v = board[i][j]\n",
            "                    if v == 0: continue\n",
            "                    if v == prev: return True\n",
            "                    prev = v\n",
            "        if dir == 3:  # right\n",
            "            for i in range(n):\n",
            "                prev = -1\n",
            "                for j in range(n-1, -1, -1):\n",
            "                    v = board[i][j]\n",
            "                    if v == 0: continue\n",
            "                    if v == prev: return True\n",
            "                    prev = v\n",
            "        return False\n",
            "\n",
            "    for d in range(4):\n",
            "        if can_move(board, d):\n",
            "            return str(d)\n",
            "    return \"0\"\n",
            "Steps = 18 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "None\n",
            "Steps = 10 If Done = False\n",
            "def strategy(board):\n",
            "    # Evaluate simple heuristic: compare sums for each move\n",
            "    def move_score(b, dir):\n",
            "        moves = []\n",
            "        size = len(b)\n",
            "        for i in range(size):\n",
            "            for j in range(size):\n",
            "                if b[i][j] == 0: continue\n",
            "                r, c = i, j\n",
            "                value = b[i][j]\n",
            "                while True:\n",
            "                    if dir == 0:   # up\n",
            "                        if r == 0 or b[r-1][c] != 0 and b[r-1][c] != value: break\n",
            "                        r -= 1\n",
            "                    elif dir == 1: # down\n",
            "                        if r == size-1 or b[r+1][c] != 0 and b[r+1][c] != value: break\n",
            "                        r += 1\n",
            "                    elif dir == 2: # left\n",
            "                        if c == 0 or b[r][c-1] != 0 and b[r][c-1] != value: break\n",
            "                        c -= 1\n",
            "                    else:          # right\n",
            "                        if c == size-1 or b[r][c+1] != 0 and b[r][c+1] != value: break\n",
            "                        c += 1\n",
            "                if b[r][c] == 0:\n",
            "                    moves.append((r, c, value))\n",
            "        return len(moves) + sum(v for _,_,v in moves)\n",
            "\n",
            "    scores = [move_score(board, d) for d in range(4)]\n",
            "    return str(scores.index(max(scores)))\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    # board is a list of list of ints, 4x4, 0 for empty\n",
            "    # Simpler heuristic: move toward the corners\n",
            "    # Preference: up (0) > left (1) > down (2) > right (3)\n",
            "    # Count empty cells\n",
            "    empty = sum(1 for row in board for v in row if v == 0)\n",
            "    # If many empties, favor up to increase space\n",
            "    if empty >= 12:\n",
            "        return \"0\"  # up\n",
            "    # Otherwise, move towards the largest tile\n",
            "    max_val = max(max(row) for row in board)\n",
            "    for i, row in enumerate(board):\n",
            "        for j, val in enumerate(row):\n",
            "            if val == max_val:\n",
            "                if i < 2:\n",
            "                    return \"0\"  # up\n",
            "                if j < 2:\n",
            "                    return \"1\"  # left\n",
            "                if i > 1:\n",
            "                    return \"2\"  # down\n",
            "                if j > 1:\n",
            "                    return \"3\"  # right\n",
            "    return \"1\"  # default to left\n",
            "Steps = 4 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 58 If Done = False\n",
            "def strategy(board):\n",
            "    # Simple heuristic: if any row has two candidates with same sum, prioritize that\n",
            "    best=None\n",
            "    for i in range(4):\n",
            "        for j in range(4):\n",
            "            if board[i][j]==0: continue\n",
            "            for d in (\"0\",\"1\",\"2\",\"3\"):\n",
            "                if d==\"0\":\n",
            "                    ni,nj=i,i+1\n",
            "                elif d==\"1\":\n",
            "                    ni,nj=i,i-1\n",
            "                elif d==\"2\":\n",
            "                    ni,nj=i+1,j\n",
            "                else:\n",
            "                    ni,nj=i-1,j\n",
            "                if 0<=ni<4 and 0<=nj<4 and board[ni][nj]==0:\n",
            "                    return d\n",
            "    return \"0\"\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;51m  4\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 2 If Done = False\n",
            "def strategy(board):\n",
            "    # evaluate all four moves and pick the one with the highest expected score\n",
            "    def move(board, dir):\n",
            "        # apply move using 2048 rules\n",
            "        size = len(board)\n",
            "        def compress(row):\n",
            "            new = [x for x in row if x != 0]\n",
            "            i = 0\n",
            "            merged = []\n",
            "            while i < len(new):\n",
            "                if i+1 < len(new) and new[i]==new[i+1]:\n",
            "                    merged.append(new[i]*2)\n",
            "                    i += 2\n",
            "                else:\n",
            "                    merged.append(new[i])\n",
            "                    i += 1\n",
            "            merged += [0]*(size-len(merged))\n",
            "            return merged\n",
            "        if dir == 0:  # up\n",
            "            res = [[0]*size for _ in range(size)]\n",
            "            for j in range(size):\n",
            "                col = [board[i][j] for i in range(size)]\n",
            "                newcol = compress(col)\n",
            "                for i in range(size):\n",
            "                    res[i][j] = newcol[i]\n",
            "            return res\n",
            "        if dir == 1:  # down\n",
            "            res = [[0]*size for _ in range(size)]\n",
            "            for j in range(size):\n",
            "                col = [board[i][j] for i in range(size)][::-1]\n",
            "                newcol = compress(col)[::-1]\n",
            "                for i in range(size):\n",
            "                    res[i][j] = newcol[i]\n",
            "            return res\n",
            "        if dir == 2:  # left\n",
            "            res = []\n",
            "            for row in board:\n",
            "                newrow = compress(row)\n",
            "                res.append(newrow)\n",
            "            return res\n",
            "        if dir == 3:  # right\n",
            "            res = []\n",
            "            for row in board:\n",
            "                newrow = compress(row[::-1])[::-1]\n",
            "                res.append(newrow)\n",
            "            return res\n",
            "    best_score = -1\n",
            "    best_dir = 0\n",
            "    for d in range(4):\n",
            "        new = move(board, d)\n",
            "        score = sum(max(row) for row in new)\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best_dir = d\n",
            "    return str(best_dir)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 4 If Done = False\n",
            "def strategy(board):\n",
            "    def move(board, dir):\n",
            "        def rotate(b, times):\n",
            "            for _ in range(times):\n",
            "                b = [list(row) for row in zip(*b[::-1])]\n",
            "            return b\n",
            "        if dir==0: board=rotate(board,0)\n",
            "        if dir==1: board=rotate(board,1)\n",
            "        if dir==2: board=rotate(board,2)\n",
            "        if dir==3: board=rotate(board,3)\n",
            "        new=[]\n",
            "        for row in board:\n",
            "            merged=[]\n",
            "            skip=0\n",
            "            for i in range(len(row)):\n",
            "                if skip: skip=0; continue\n",
            "                if row[i]!=0:\n",
            "                    val=row[i]\n",
            "                    if i+1<len(row) and row[i+1]==val:\n",
            "                        val*=2; skip=1\n",
            "                    merged.append(val)\n",
            "            merged+=[0]*(len(row)-len(merged))\n",
            "            new.append(merged)\n",
            "        return rotate(new, (4-dir)%4)\n",
            "\n",
            "    best_move=None; best_score=-1\n",
            "    for m in range(4):\n",
            "        nxt=move(board,m)\n",
            "        score=sum(sum(row) for row in nxt)\n",
            "        if score>best_score:\n",
            "            best_score=score; best_move=m\n",
            "    return str(best_move)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 2 If Done = False\n",
            "def strategy(board):\n",
            "    # scores: 0=up,1=down,2=left,3=right\n",
            "    def mutate(b, move):\n",
            "        import copy\n",
            "        b = copy.deepcopy(b)\n",
            "        for i in range(4):\n",
            "            line = []\n",
            "            for j in range(4):\n",
            "                if move in (0,2):\n",
            "                    val = b[j][i] if move == 0 else b[i][j]\n",
            "                else:\n",
            "                    val = b[i][j] if move == 1 else b[j][i]\n",
            "                if val: line.append(val)\n",
            "            merged = []\n",
            "            skip = False\n",
            "            for k in range(len(line)):\n",
            "                if skip:\n",
            "                    skip=False\n",
            "                    continue\n",
            "                if k+1 < len(line) and line[k]==line[k+1]:\n",
            "                    merged.append(line[k]*2)\n",
            "                    skip=True\n",
            "                else:\n",
            "                    merged.append(line[k])\n",
            "            merged += [0]*(4-len(merged))\n",
            "            for k in range(4):\n",
            "                if move in (0,2):\n",
            "                    if move == 0:\n",
            "                        b[k][i] = merged[k]\n",
            "                    else:\n",
            "                        b[i][k] = merged[k]\n",
            "                else:\n",
            "                    if move == 1:\n",
            "                        b[i][k] = merged[k]\n",
            "                    else:\n",
            "                        b[k][i] = merged[k]\n",
            "        return b\n",
            "    best = -1\n",
            "    bestmove = 0\n",
            "    for m in range(4):\n",
            "        nb = mutate(board, m)\n",
            "        val = sum(sum(row) for row in nb)\n",
            "        if val > best:\n",
            "            best = val\n",
            "            bestmove = m\n",
            "    return str(bestmove)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    # simple heuristic: move that preserves most tiles\n",
            "    best = None\n",
            "    max_keep = -1\n",
            "    for move in range(4):\n",
            "        b = [row[:] for row in board]\n",
            "        # apply move\n",
            "        if move==0:  # up\n",
            "            for c in range(4):\n",
            "                col=[b[r][c] for r in range(4) if b[r][c]!=0]\n",
            "                for i in range(len(col)-1):\n",
            "                    if col[i]==col[i+1]:\n",
            "                        col[i]+=col.pop(i+1)\n",
            "                for r in range(4): b[r][c]=col[r] if r<len(col) else 0\n",
            "        elif move==1:  # down\n",
            "            for c in range(4):\n",
            "                col=[b[r][c] for r in range(4) if b[r][c]!=0]\n",
            "                for i in range(len(col)-1,0,-1):\n",
            "                    if col[i]==col[i-1]:\n",
            "                        col[i-1]+=col.pop(i)\n",
            "                for r in range(3,-1,-1): b[r][c]=col[3-r] if r>=4-len(col) else 0\n",
            "        elif move==2:  # left\n",
            "            for r in range(4):\n",
            "                row=[b[r][c] for c in range(4) if b[r][c]!=0]\n",
            "                for i in range(len(row)-1):\n",
            "                    if row[i]==row[i+1]:\n",
            "                        row[i]+=row.pop(i+1)\n",
            "                for c in range(4): b[r][c]=row[c] if c<len(row) else 0\n",
            "        else:  # right\n",
            "            for r in range(4):\n",
            "                row=[b[r][c] for c in range(4) if b[r][c]!=0]\n",
            "                for i in range(len(row)-1,0,-1):\n",
            "                    if row[i]==row[i-1]:\n",
            "                        row[i-1]+=row.pop(i)\n",
            "                for c in range(3,-1,-1): b[r][c]=row[3-c] if c>=4-len(row) else 0\n",
            "        # count non-zero tiles\n",
            "        keep=sum(v!=0 for row in b for v in row)\n",
            "        if keep>max_keep:\n",
            "            max_keep=keep\n",
            "            best=move\n",
            "    return str(best)\n",
            "Exception = list index out of range\n",
            "Steps = 5 If Done = False\n",
            "def strategy(board):\n",
            "    # Scan for any possible merge, prefer larger tiles\n",
            "    best = None\n",
            "    for i in range(4):\n",
            "        for j in range(4):\n",
            "            tile = board[i][j]\n",
            "            if tile == 0: continue\n",
            "            # Check right\n",
            "            if j < 3 and board[i][j+1] == tile:\n",
            "                return \"2\"\n",
            "            # Check left\n",
            "            if j > 0 and board[i][j-1] == tile:\n",
            "                return \"3\"\n",
            "            # Check down\n",
            "            if i < 3 and board[i+1][j] == tile:\n",
            "                return \"1\"\n",
            "            # Check up\n",
            "            if i > 0 and board[i-1][j] == tile:\n",
            "                return \"0\"\n",
            "    # If no merge, push towards corner\n",
            "    if board[0][0] == 0: return \"0\"\n",
            "    if board[0][3] == 0: return \"1\"\n",
            "    if board[3][0] == 0: return \"2\"\n",
            "    return \"3\"\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 19 If Done = False\n",
            "def strategy(board):\n",
            "    # helper to simulate a move\n",
            "    def move(b, dir):\n",
            "        n=len(b)\n",
            "        res=[[0]*n for _ in range(n)]\n",
            "        for i in range(n):\n",
            "            line=[]\n",
            "            for j in range(n):\n",
            "                if dir==0:  # left\n",
            "                    if j>=i: line.append(b[i][j])\n",
            "                elif dir==1:  # right\n",
            "                    if j<=n-i-1: line.append(b[i][j])\n",
            "                elif dir==2:  # up\n",
            "                    if i>=j: line.append(b[i][j])\n",
            "                else:  # down\n",
            "                    if i<=n-j-1: line.append(b[i][j])\n",
            "            merged=[]\n",
            "            k=0\n",
            "            while k<len(line):\n",
            "                if k+1<len(line) and line[k]==line[k+1]:\n",
            "                    merged.append(line[k]*2); k+=2\n",
            "                else:\n",
            "                    merged.append(line[k]); k+=1\n",
            "            # fill result\n",
            "            for j in range(n):\n",
            "                if dir==0:\n",
            "                    if j<i: res[i][j]=merged[j] if j< len(merged) else 0\n",
            "                elif dir==1:\n",
            "                    if j>=n-i: res[i][j]=merged[j-(n-i)] if j-(n-i)<len(merged) else 0\n",
            "                elif dir==2:\n",
            "                    if j<i: res[j][i]=merged[j] if j<len(merged) else 0\n",
            "                else:\n",
            "                    if j>=n-i: res[j][i]=merged[j-(n-i)] if j-(n-i)<len(merged) else 0\n",
            "        return res\n",
            "\n",
            "    # evaluate move\n",
            "    best=None; best_score=-1; best_move=None\n",
            "    for m in range(4):\n",
            "        new=move(board,m)\n",
            "        # simple score: sum of tiles\n",
            "        score=sum(sum(row) for row in new)\n",
            "        if score>best_score:\n",
            "            best_score=score; best_move=str(m)\n",
            "    return best_move\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 6 If Done = False\n",
            "def strategy(board):\n",
            "    import copy\n",
            "    def simulate(b,dir):\n",
            "        n=len(b); new=[[0]*n for _ in range(n)]\n",
            "        for i in range(n):\n",
            "            line=[b[i][j] for j in range(n) if b[i][j]!=0]\n",
            "            if dir==0:  # up\n",
            "                line=line[::-1]\n",
            "            if dir==1:  # right\n",
            "                pass\n",
            "            # (simplified: only count empty after move)\n",
            "            return line\n",
            "    best=0; max_empty=-1\n",
            "    for d in range(4):\n",
            "        line=simulate(board,d)\n",
            "        empty=sum(1 for v in line if v==0)\n",
            "        if empty>max_empty:\n",
            "            max_empty=empty; best=d\n",
            "    return str(best)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "None\n",
            "Steps = 3 If Done = False\n",
            "def strategy(board):\n",
            "    import random\n",
            "    moves = []\n",
            "    for i in range(4):\n",
            "        for j in range(4):\n",
            "            if board[i][j] == 0:\n",
            "                return \"0\"\n",
            "    return random.choice([\"0\",\"1\",\"2\",\"3\"])\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 17 If Done = False\n",
            "def strategy(board):\n",
            "    \"\"\"\n",
            "    Very simple strategy: choose the move that merges the most tiles.\n",
            "    \"\"\"\n",
            "    import operator\n",
            "\n",
            "    def count_merges(dir_move):\n",
            "        rows = len(board)\n",
            "        cols = len(board[0])\n",
            "        count = 0\n",
            "        for i in range(rows):\n",
            "            for j in range(cols):\n",
            "                if board[i][j] == 0:\n",
            "                    continue\n",
            "                ni, nj = i, j\n",
            "                if dir_move == 0:  # up\n",
            "                    while ni > 0 and board[ni-1][nj] == 0:\n",
            "                        ni -= 1\n",
            "                elif dir_move == 1:  # down\n",
            "                    while ni < rows-1 and board[ni+1][nj] == 0:\n",
            "                        ni += 1\n",
            "                elif dir_move == 2:  # left\n",
            "                    while nj > 0 and board[ni][nj-1] == 0:\n",
            "                        nj -= 1\n",
            "                else:  # right\n",
            "                    while nj < cols-1 and board[ni][nj+1] == 0:\n",
            "                        nj += 1\n",
            "                if ni != i or nj != j:\n",
            "                    count += 1\n",
            "        return count\n",
            "\n",
            "    best_move = 0\n",
            "    best_score = -1\n",
            "    for m in range(4):\n",
            "        score = count_merges(m)\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best_move = m\n",
            "    return str(best_move)\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;51m  4\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 28 If Done = False\n",
            "def strategy(board):\n",
            "    \"\"\"\n",
            "    Mine: A tiny 2048 strategy that plays a deterministic\n",
            "    first opportunity that keeps tile movement to the top‑left.\n",
            "    The strategy selects an action that moves tiles towards the\n",
            "    upper left corner when possible.\n",
            "    \"\"\"\n",
            "    # board is a 4x4 list of lists\n",
            "    # Directions: 0=up, 1=down, 2=left, 3=right\n",
            "    import copy\n",
            "\n",
            "    def can_move(b, d):\n",
            "        # simulate move and see if board changes\n",
            "        new = copy.deepcopy(b)\n",
            "        if d == 0:   # up\n",
            "            for c in range(4):\n",
            "                col = [new[r][c] for r in range(4)]\n",
            "                merged = merge(col)\n",
            "                for r in range(4):\n",
            "                    new[r][c] = merged[r]\n",
            "        elif d == 1: # down\n",
            "            for c in range(4):\n",
            "                col = [new[r][c] for r in reversed(range(4))]\n",
            "                merged = merge(col)\n",
            "                for i, r in enumerate(reversed(range(4))):\n",
            "                    new[r][c] = merged[i]\n",
            "        elif d == 2: # left\n",
            "            for r in range(4):\n",
            "                row = new[r]\n",
            "                merged = merge(row)\n",
            "                new[r] = merged\n",
            "        else:        # right\n",
            "            for r in range(4):\n",
            "                row = list(reversed(new[r]))\n",
            "                merged = merge(row)\n",
            "                new[r] = list(reversed(merged))\n",
            "        return new != b\n",
            "\n",
            "    def merge(line):\n",
            "        # compress non-zeros\n",
            "        filtered = [x for x in line if x]\n",
            "        merged = []\n",
            "        i = 0\n",
            "        while i < len(filtered):\n",
            "            if i+1 < len(filtered) and filtered[i] == filtered[i+1]:\n",
            "                merged.append(filtered[i]*2)\n",
            "                i += 2\n",
            "            else:\n",
            "                merged.append(filtered[i])\n",
            "                i += 1\n",
            "        merged += [0]*(len(line)-len(merged))\n",
            "        return merged\n",
            "\n",
            "    # try up, left, down, right in that order\n",
            "    for d in [0, 2, 1, 3]:\n",
            "        if can_move(board, d):\n",
            "            return str(d)\n",
            "    return \"0\"  # default if no moves\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "def strategy(board):\n",
            "    import random, copy\n",
            "    moves = [\"0\",\"1\",\"2\",\"3\"]\n",
            "    best = None\n",
            "    best_score = -1\n",
            "    for m in moves:\n",
            "        new_b = copy.deepcopy(board)\n",
            "        # simulate move (placeholder: no actual logic, just random)\n",
            "        score = sum(sum(row) for row in new_b) + random.random()\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best = m\n",
            "    return best\n",
            "Steps = 11 If Done = False\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 3 If Done = False\n",
            "def strategy(board):\n",
            "    # Simple heuristic: try to move left if possible, otherwise random.\n",
            "    from random import choice\n",
            "    # Check if any left move is valid\n",
            "    for r in range(len(board)):\n",
            "        for c in range(1, len(board[0])):\n",
            "            if board[r][c] == 0 and board[r][c-1] != 0:\n",
            "                return \"0\"\n",
            "    return str(choice([0, 1, 2, 3]))\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 10 If Done = False\n",
            "def strategy(board):\n",
            "    # Utility functions\n",
            "    def move(board, dir):\n",
            "        # Merge logic for one move\n",
            "        n = len(board)\n",
            "        def compress(row):\n",
            "            new_row = [x for x in row if x != 0]\n",
            "            merged = []\n",
            "            i = 0\n",
            "            while i < len(new_row):\n",
            "                if i+1 < len(new_row) and new_row[i] == new_row[i+1]:\n",
            "                    merged.append(new_row[i]*2)\n",
            "                    i += 2\n",
            "                else:\n",
            "                    merged.append(new_row[i])\n",
            "                    i += 1\n",
            "            merged += [0]*(n-len(merged))\n",
            "            return merged\n",
            "\n",
            "        if dir == 0:            # up\n",
            "            for j in range(n):\n",
            "                col = [board[i][j] for i in range(n)]\n",
            "                new_col = compress(col)\n",
            "                for i in range(n):\n",
            "                    board[i][j] = new_col[i]\n",
            "        elif dir == 1:          # down\n",
            "            for j in range(n):\n",
            "                col = [board[i][j] for i in range(n)][::-1]\n",
            "                new_col = compress(col)[::-1]\n",
            "                for i in range(n):\n",
            "                    board[i][j] = new_col[i]\n",
            "        elif dir == 2:          # left\n",
            "            for i in range(n):\n",
            "                row = board[i]\n",
            "                board[i] = compress(row)\n",
            "        else:                   # right\n",
            "            for i in range(n):\n",
            "                row = board[i][::-1]\n",
            "                new_row = compress(row)[::-1]\n",
            "                board[i] = new_row\n",
            "\n",
            "    def empty_cells(b):\n",
            "        return sum(cell == 0 for row in b for cell in row)\n",
            "\n",
            "    best_dir, best_score = None, -1\n",
            "    for d in range(4):\n",
            "        b_copy = [row[:] for row in board]\n",
            "        move(b_copy, d)\n",
            "        score = empty_cells(b_copy)\n",
            "        if score > best_score:\n",
            "            best_score = score\n",
            "            best_dir = str(d)\n",
            "    return best_dir\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n",
            "Steps = 1 If Done = False\n",
            "def strategy(board):\n",
            "    from copy import deepcopy\n",
            "    def move(board, dir):\n",
            "        N=len(board); new=[[0]*N for _ in range(N)]\n",
            "        for i in range(N):\n",
            "            line=[]\n",
            "            for j in range(N):\n",
            "                if dir==0:  # left\n",
            "                    val=board[i][j]\n",
            "                elif dir==1:  # right\n",
            "                    val=board[i][N-1-j]\n",
            "                elif dir==2:  # up\n",
            "                    val=board[j][i]\n",
            "                else:  # down\n",
            "                    val=board[N-1-j][i]\n",
            "                if val:\n",
            "                    line.append(val)\n",
            "            merged=[]\n",
            "            skip=False\n",
            "            for k in range(len(line)):\n",
            "                if skip: \n",
            "                    skip=False; continue\n",
            "                if k+1<len(line) and line[k]==line[k+1]:\n",
            "                    merged.append(line[k]*2)\n",
            "                    skip=True\n",
            "                else:\n",
            "                    merged.append(line[k])\n",
            "            for idx, val in enumerate(merged):\n",
            "                if dir==0: new[i][idx]=val\n",
            "                elif dir==1: new[i][N-1-idx]=val\n",
            "                elif dir==2: new[idx][i]=val\n",
            "                else: new[N-1-idx][i]=val\n",
            "        return new\n",
            "    best=None; bestScore=-1; bestDir=None\n",
            "    for d in range(4):\n",
            "        new=move(board,d)\n",
            "        if any(any(cell!=0 for cell in row) for row in new):\n",
            "            score=sum(sum(row) for row in new)\n",
            "            if score>bestScore:\n",
            "                bestScore=score; bestDir=d\n",
            "    return str(bestDir) if bestDir is not None else \"0\"\n",
            "┌───┬───┬───┬───┐\n",
            "│\u001b[38;5;45m  2\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;45m  2\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "├───┼───┼───┼───┤\n",
            "│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\u001b[38;5;239m  .\u001b[0m│\n",
            "└───┴───┴───┴───┘\n"
          ]
        }
      ],
      "source": [
        "trainer.train()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "tlaUdxC_VHpz"
      },
      "source": [
        "<a name=\"Inference\"></a>\n",
        "# Inference\n",
        "Now let's try the model we just trained!"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 35,
      "metadata": {
        "id": "TwZygRdWf8ab",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "92618955-4a32-4f0e-c100-54ad33f84e8a"
      },
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "<|start|>system<|message|>You are ChatGPT, a large language model trained by OpenAI.\n",
            "Knowledge cutoff: 2024-06\n",
            "Current date: 2025-11-25\n",
            "\n",
            "Reasoning: low\n",
            "\n",
            "# Valid channels: analysis, commentary, final. Channel must be included for every message.\n",
            "Calls to these tools must go to the commentary channel: 'functions'.<|end|><|start|>user<|message|>Create a new short 2048 strategy using only native Python code.\n",
            "You are given a list of list of numbers for the current board state.\n",
            "Output one action for \"0\", \"1\", \"2\", \"3\" on what is the optimal next step.\n",
            "Output your new short function in backticks using the format below:\n",
            "```python\n",
            "def strategy(board):\n",
            "    return \"0\" # Example\n",
            "```\n",
            "All helper functions should be inside def strategy. Only output the short function `strategy`.<|end|><|start|>assistant<|channel|>analysis<|message|>We need to write a short function that, given board (list of lists), outputs optimal move. Use simple heuristic: count possible moves, prioritize. Just code minimal logic.\n",
            "\n",
            "Let's produce function.<|end|><|start|>assistant<|channel|>final<|message|>```python\n",
            "def strategy(board):\n",
            "    # Board is a list of 4 lists of 4 ints, 0 means empty.\n",
            "    # Simple heuristic: try moves that merge at least one pair and avoid wall moves.\n",
            "    dirs = [\"0\",\"1\",\"2\",\"3\"]  # up, down, left, right\n",
            "    def can_merge(d):\n",
            "        n = len(board)\n",
            "        for i in range(n):\n",
            "            for j in range(n):\n",
            "                if board[i][j]==0: continue\n",
            "                # check neighbor in direction d\n",
            "                if d==0:  # up\n",
            "                    if i>0 and board[i-1][j]==board[i][j]:\n",
            "                        return True\n",
            "                if d==1:  # down\n",
            "                    if i<n-1 and board[i+1][j]==board[i][j]:\n",
            "                        return True\n",
            "                if d==2:  # left\n",
            "                    if j>0 and board[i][j-1]==board[i][j]:\n",
            "                        return True\n",
            "                if d==3:  # right\n",
            "                    if j<n-1 and board[i][j+1]==board[i][j]:\n",
            "                        return True\n",
            "        return False\n",
            "\n",
            "    for d in range(4):\n",
            "        if can_merge(d):\n",
            "            return str(d)\n",
            "    return \"0\"\n",
            "```<|return|>\n"
          ]
        }
      ],
      "source": [
        "text = tokenizer.apply_chat_template(\n",
        "    [{\"role\": \"user\", \"content\": prompt}],\n",
        "    tokenize = False,\n",
        "    add_generation_prompt = True,\n",
        "    reasoning_effort = \"low\",\n",
        ")\n",
        "\n",
        "from transformers import TextStreamer\n",
        "_ = model.generate(\n",
        "    **tokenizer(text, return_tensors = \"pt\").to(\"cuda\"),\n",
        "    temperature = 1.0,\n",
        "    max_new_tokens = 1024,\n",
        "    streamer = TextStreamer(tokenizer, skip_prompt = False),\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-NUEmHFSYNTp"
      },
      "source": [
        "<a name=\"Save\"></a>\n",
        "### Saving to float16 or `MXFP4`\n",
        "\n",
        "We also support saving to `float16` directly. Select `merged_16bit` for float16 or `mxfp4` for MXFP4 (OpenAI's GPT-OSS native precision). We also allow `lora` adapters as a fallback. Use `push_to_hub_merged` to upload to your Hugging Face account! You can go to https://huggingface.co/settings/tokens for your personal tokens."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 36,
      "metadata": {
        "id": "NjXGTkp7YNtB"
      },
      "outputs": [],
      "source": [
        "# Merge and push to hub in mxfp4 4bit format\n",
        "if False:\n",
        "    model.save_pretrained_merged(\"finetuned_model\", tokenizer, save_method = \"mxfp4\")\n",
        "if False:\n",
        "    model.push_to_hub_merged(\"repo_id/repo_name\", tokenizer, token = \"hf...\", save_method = \"mxfp4\")\n",
        "\n",
        "# Merge and push to hub in 16bit\n",
        "if False:\n",
        "    model.save_pretrained_merged(\"finetuned_model\", tokenizer, save_method = \"merged_16bit\")\n",
        "if False: # Pushing to HF Hub\n",
        "    model.push_to_hub_merged(\"hf/gpt-oss-finetune\", tokenizer, save_method = \"merged_16bit\", token = \"\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "V15Yhj1V9lwG"
      },
      "source": [
        "# And we're done!\n",
        "Congratulations you just learned how to do reinforcement learning with GPT-OSS! There were some advanced topics explained in this notebook - to learn more about GPT-OSS and RL, there are more docs in Unsloth's [Reinforcement Learning Guide with GPT-OSS](https://docs.unsloth.ai/new/gpt-oss-reinforcement-learning)\n",
        "\n",
        "This notebook and all Unsloth notebooks are licensed [LGPL-3.0](https://github.com/unslothai/notebooks?tab=LGPL-3.0-1-ov-file#readme)."
      ]
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "gpuType": "T4",
      "provenance": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "f322d842499341d59846362ca89b18d6": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_266891f93a724881be4bc77a9c98f8fc",
              "IPY_MODEL_7ace0fdc545e4092bc1309bbd667d895",
              "IPY_MODEL_1909e4395f304d19acb118744cbc12e7"
            ],
            "layout": "IPY_MODEL_336f7a348c3749f1ac3cce6a9925067b"
          }
        },
        "266891f93a724881be4bc77a9c98f8fc": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_65896147f42d4c648becf2a9a1b1b573",
            "placeholder": "​",
            "style": "IPY_MODEL_adf3ad3523c84b0dabe729f54020afba",
            "value": "model.safetensors.index.json: "
          }
        },
        "7ace0fdc545e4092bc1309bbd667d895": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_141fe656e7f6467ba8be61f8a9bd80aa",
            "max": 1,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_037f9d5ec256422b985619beac4855ff",
            "value": 1
          }
        },
        "1909e4395f304d19acb118744cbc12e7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4a3de13bfbb345cd97ff32e05cfd360d",
            "placeholder": "​",
            "style": "IPY_MODEL_740bc9d417d0405e9488e0b4bd6f15b8",
            "value": " 1.19M/? [00:00&lt;00:00, 56.7MB/s]"
          }
        },
        "336f7a348c3749f1ac3cce6a9925067b": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "65896147f42d4c648becf2a9a1b1b573": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "adf3ad3523c84b0dabe729f54020afba": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "141fe656e7f6467ba8be61f8a9bd80aa": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": "20px"
          }
        },
        "037f9d5ec256422b985619beac4855ff": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "4a3de13bfbb345cd97ff32e05cfd360d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "740bc9d417d0405e9488e0b4bd6f15b8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "8215a8d597454ca887a130a96e3c6d5f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_9c7e7d50f12446e0873220b038a4bedd",
              "IPY_MODEL_a824463d8e224dbca6ac734ad8e55d00",
              "IPY_MODEL_50353ef7dac5461eb8f74b3708576b8f"
            ],
            "layout": "IPY_MODEL_9cc5e02c0ad348d29a9284a293a533b4"
          }
        },
        "9c7e7d50f12446e0873220b038a4bedd": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_c2a884b997b6465c8457c8b125157738",
            "placeholder": "​",
            "style": "IPY_MODEL_6b0f702505c04bb0ac655ca283a9bdd3",
            "value": "model-00001-of-00004.safetensors: 100%"
          }
        },
        "a824463d8e224dbca6ac734ad8e55d00": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3c9b4de557634ed5a0a147349e82470f",
            "max": 3998751275,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_afc92eb8a97e4c95962993384b35f592",
            "value": 3998751275
          }
        },
        "50353ef7dac5461eb8f74b3708576b8f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_ddd46638ff44402eb74eab249d2c37d4",
            "placeholder": "​",
            "style": "IPY_MODEL_2097b70b61d04763b87a33cc003394e4",
            "value": " 4.00G/4.00G [00:30&lt;00:00, 75.2MB/s]"
          }
        },
        "9cc5e02c0ad348d29a9284a293a533b4": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "c2a884b997b6465c8457c8b125157738": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "6b0f702505c04bb0ac655ca283a9bdd3": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "3c9b4de557634ed5a0a147349e82470f": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "afc92eb8a97e4c95962993384b35f592": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "ddd46638ff44402eb74eab249d2c37d4": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "2097b70b61d04763b87a33cc003394e4": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "6a74a22829ff4d648a13c2c3b09f15c4": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_38db602bf1ec484e8d1d832e9005150e",
              "IPY_MODEL_6c72f8b28db4477eb58aa18259a96c3e",
              "IPY_MODEL_a743efb16d1a448b9e2125b55e6d808b"
            ],
            "layout": "IPY_MODEL_6c43c1c6e4bd4bc8ab8b5c447e3bf931"
          }
        },
        "38db602bf1ec484e8d1d832e9005150e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3525a328a00641aaa286e5c81af678af",
            "placeholder": "​",
            "style": "IPY_MODEL_3a75acb2f4bf446a83ce4006e834fb3e",
            "value": "model-00002-of-00004.safetensors: 100%"
          }
        },
        "6c72f8b28db4477eb58aa18259a96c3e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_a17c314789ba464da246eca7f85e8f58",
            "max": 3996690997,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_48bf838eaf97412a9ca17a159578e484",
            "value": 3996690997
          }
        },
        "a743efb16d1a448b9e2125b55e6d808b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_e5a31377954540948291fe9ff03fc3c6",
            "placeholder": "​",
            "style": "IPY_MODEL_8d98e3038f814fa186f0e12426337b01",
            "value": " 4.00G/4.00G [00:25&lt;00:00, 257MB/s]"
          }
        },
        "6c43c1c6e4bd4bc8ab8b5c447e3bf931": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "3525a328a00641aaa286e5c81af678af": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "3a75acb2f4bf446a83ce4006e834fb3e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "a17c314789ba464da246eca7f85e8f58": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "48bf838eaf97412a9ca17a159578e484": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "e5a31377954540948291fe9ff03fc3c6": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "8d98e3038f814fa186f0e12426337b01": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "dc3cdbf2b85844539a06eda6e41c66a1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_6acfe0b8e2954b7092e63930c707bcc8",
              "IPY_MODEL_4198c588a83b43f7ab77583558d9470f",
              "IPY_MODEL_76fc413095fd4299829c3659134c67db"
            ],
            "layout": "IPY_MODEL_ea07fa6289cc4264ad80d26818ae2037"
          }
        },
        "6acfe0b8e2954b7092e63930c707bcc8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_be4e6e6684ac4eeaa3beeac6962ff44f",
            "placeholder": "​",
            "style": "IPY_MODEL_72252d0e1f6448c093d9463f2f63564e",
            "value": "model-00003-of-00004.safetensors: 100%"
          }
        },
        "4198c588a83b43f7ab77583558d9470f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_2f927841210e4184baa6d122b3cb80e8",
            "max": 3372033380,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_8996362fc4e049d7b211e0b3a25cd36f",
            "value": 3372033380
          }
        },
        "76fc413095fd4299829c3659134c67db": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9224be8c224b4aec84aadd95ed2b5150",
            "placeholder": "​",
            "style": "IPY_MODEL_06cb14329ff44d62be6a1ddbd48da2c4",
            "value": " 3.37G/3.37G [00:28&lt;00:00, 87.4MB/s]"
          }
        },
        "ea07fa6289cc4264ad80d26818ae2037": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "be4e6e6684ac4eeaa3beeac6962ff44f": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "72252d0e1f6448c093d9463f2f63564e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "2f927841210e4184baa6d122b3cb80e8": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "8996362fc4e049d7b211e0b3a25cd36f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "9224be8c224b4aec84aadd95ed2b5150": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "06cb14329ff44d62be6a1ddbd48da2c4": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "218406f5ab104351b20e9952d34ef701": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_4cb488c380dd46d19646fd42d190d7f8",
              "IPY_MODEL_3ffb1e8c956c4dbcaee1c90d6dc29b3e",
              "IPY_MODEL_5d2419316fcb45d1b438a48641901619"
            ],
            "layout": "IPY_MODEL_5c5eec94c9644c6787f6bb6747be9df5"
          }
        },
        "4cb488c380dd46d19646fd42d190d7f8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4e1667158f724141ad9be3c53ad43fb8",
            "placeholder": "​",
            "style": "IPY_MODEL_b021c18f2fd24231aa5a1a62a49e3aab",
            "value": "model-00004-of-00004.safetensors: 100%"
          }
        },
        "3ffb1e8c956c4dbcaee1c90d6dc29b3e": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_9731dfa03d0d443ea6063d479a8d00d3",
            "max": 1158267008,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_9ad24dc59428469ea1d9dad820002aa5",
            "value": 1158267008
          }
        },
        "5d2419316fcb45d1b438a48641901619": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_c301875ed80f44f78677f4beebc9cefb",
            "placeholder": "​",
            "style": "IPY_MODEL_08ab98428cf94bc994d1073849eb5bb5",
            "value": " 1.16G/1.16G [00:17&lt;00:00, 174MB/s]"
          }
        },
        "5c5eec94c9644c6787f6bb6747be9df5": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "4e1667158f724141ad9be3c53ad43fb8": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "b021c18f2fd24231aa5a1a62a49e3aab": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "9731dfa03d0d443ea6063d479a8d00d3": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "9ad24dc59428469ea1d9dad820002aa5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "c301875ed80f44f78677f4beebc9cefb": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "08ab98428cf94bc994d1073849eb5bb5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "3f35fa2276b6452ca87794af6463015d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_d3d7f6ea2b144fc381b0f5f4872c6338",
              "IPY_MODEL_2683f25f5efb429c8c9913d8112aaa00",
              "IPY_MODEL_8f8c4fa0309e402e83ec1a1a95062cf6"
            ],
            "layout": "IPY_MODEL_7d0e216389d04d3aa813908c855d0225"
          }
        },
        "d3d7f6ea2b144fc381b0f5f4872c6338": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_92fe46b183984e2796c357d91d8e0e01",
            "placeholder": "​",
            "style": "IPY_MODEL_bb97dbe7f71d49d388a198fb3696147b",
            "value": "Loading checkpoint shards: 100%"
          }
        },
        "2683f25f5efb429c8c9913d8112aaa00": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4fd818e7f1af491d871cce8ec87dbafc",
            "max": 4,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_f056d940b468488683cb22da504807c1",
            "value": 4
          }
        },
        "8f8c4fa0309e402e83ec1a1a95062cf6": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_8bde15a7b89345029a1989d96c8e388d",
            "placeholder": "​",
            "style": "IPY_MODEL_1e9cb7b8c80a4516a08ecb1ded2deb7b",
            "value": " 4/4 [01:02&lt;00:00, 13.08s/it]"
          }
        },
        "7d0e216389d04d3aa813908c855d0225": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "92fe46b183984e2796c357d91d8e0e01": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "bb97dbe7f71d49d388a198fb3696147b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "4fd818e7f1af491d871cce8ec87dbafc": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "f056d940b468488683cb22da504807c1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "8bde15a7b89345029a1989d96c8e388d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "1e9cb7b8c80a4516a08ecb1ded2deb7b": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "d4f53f36a67e4d83ab1a6cc87d9b26d8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_6dc5baafb6144ec99e75e3e1a47ec93d",
              "IPY_MODEL_f11d42f6838b4d818e7f623efb8d0589",
              "IPY_MODEL_3bf7450fc7504236941ef7898db9beed"
            ],
            "layout": "IPY_MODEL_acc131af4ac3410a89c45337534ec1ad"
          }
        },
        "6dc5baafb6144ec99e75e3e1a47ec93d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_f5c675e9b55d4056bf2daa159107d0da",
            "placeholder": "​",
            "style": "IPY_MODEL_90563513ff9c4fa798fba3d55efeb2b8",
            "value": "generation_config.json: 100%"
          }
        },
        "f11d42f6838b4d818e7f623efb8d0589": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_318ee566fb36440dbb2a551727d44beb",
            "max": 165,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_ccd03fbafedd407191b33eb7a300bd50",
            "value": 165
          }
        },
        "3bf7450fc7504236941ef7898db9beed": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_ac8e889be4bd45ecb23c22d0fad40968",
            "placeholder": "​",
            "style": "IPY_MODEL_89265b9fe9e3425080c2ab8d0beeceb7",
            "value": " 165/165 [00:00&lt;00:00, 18.5kB/s]"
          }
        },
        "acc131af4ac3410a89c45337534ec1ad": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "f5c675e9b55d4056bf2daa159107d0da": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "90563513ff9c4fa798fba3d55efeb2b8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "318ee566fb36440dbb2a551727d44beb": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "ccd03fbafedd407191b33eb7a300bd50": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "ac8e889be4bd45ecb23c22d0fad40968": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "89265b9fe9e3425080c2ab8d0beeceb7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "7ed42c80bb9b49d09afef1d7edf21573": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_cb68856ae17a4ab383484c7eb3b03d59",
              "IPY_MODEL_b775da85b3ff4ae4977a1502846e8915",
              "IPY_MODEL_1d0815294fe746d98b827912b0fa822d"
            ],
            "layout": "IPY_MODEL_6bfba7ea97874f89a69ec34f68ad7298"
          }
        },
        "cb68856ae17a4ab383484c7eb3b03d59": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_7c2ccd8eb68d41deab9a859f20220f5f",
            "placeholder": "​",
            "style": "IPY_MODEL_70c3435e99c14e1f9ba23c4e624ff8f1",
            "value": "tokenizer_config.json: "
          }
        },
        "b775da85b3ff4ae4977a1502846e8915": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_57440cc5e0b241e6b868c61fd8b2ecf3",
            "max": 1,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_32a58966b6a74680a71af03191e74c18",
            "value": 1
          }
        },
        "1d0815294fe746d98b827912b0fa822d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_52d7bb595be74be7842aa7a62c6f8766",
            "placeholder": "​",
            "style": "IPY_MODEL_f289a2160e5247b3b5488d01a23f68aa",
            "value": " 22.8k/? [00:00&lt;00:00, 1.21MB/s]"
          }
        },
        "6bfba7ea97874f89a69ec34f68ad7298": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "7c2ccd8eb68d41deab9a859f20220f5f": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "70c3435e99c14e1f9ba23c4e624ff8f1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "57440cc5e0b241e6b868c61fd8b2ecf3": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": "20px"
          }
        },
        "32a58966b6a74680a71af03191e74c18": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "52d7bb595be74be7842aa7a62c6f8766": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "f289a2160e5247b3b5488d01a23f68aa": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "a8518669143043c1b8149aec4c902465": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_b8e5416b0f724845807cace57e09ad39",
              "IPY_MODEL_0273638b31e44fa6935796e4299979b1",
              "IPY_MODEL_7525295f755e460d9298424eb62fc4e5"
            ],
            "layout": "IPY_MODEL_9e284d7642134c759c79e3acfd12335e"
          }
        },
        "b8e5416b0f724845807cace57e09ad39": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_4f13f9417cd54a06a5b2bec9d12f51b5",
            "placeholder": "​",
            "style": "IPY_MODEL_b002ae27c0d2450786703750e16643d8",
            "value": "tokenizer.json: 100%"
          }
        },
        "0273638b31e44fa6935796e4299979b1": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_07515545bce84bbf96ce10b76e1bea7c",
            "max": 27868174,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_2a21b5a390dc47019223a4542a86668c",
            "value": 27868174
          }
        },
        "7525295f755e460d9298424eb62fc4e5": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_fba0e171099b4eda8f89e45a34d5d888",
            "placeholder": "​",
            "style": "IPY_MODEL_ede9afd88e1a4a9b8fcd73e04bddf6c7",
            "value": " 27.9M/27.9M [00:00&lt;00:00, 45.6MB/s]"
          }
        },
        "9e284d7642134c759c79e3acfd12335e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "4f13f9417cd54a06a5b2bec9d12f51b5": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "b002ae27c0d2450786703750e16643d8": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "07515545bce84bbf96ce10b76e1bea7c": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "2a21b5a390dc47019223a4542a86668c": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "fba0e171099b4eda8f89e45a34d5d888": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "ede9afd88e1a4a9b8fcd73e04bddf6c7": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "347a34b97bbe4e3ba05182b534107645": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_db9fe0be33a54c678ae4c9c2ecf97eee",
              "IPY_MODEL_bcff078d112f46e4b1e94c035913e461",
              "IPY_MODEL_83782e2b3773487da5e48c1c4726d770"
            ],
            "layout": "IPY_MODEL_61821b87d18c4f3e938cf47935cf641e"
          }
        },
        "db9fe0be33a54c678ae4c9c2ecf97eee": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_359596af0b1846b781e5db6b68cdad7d",
            "placeholder": "​",
            "style": "IPY_MODEL_c9567139ab7d4c1bb3bb41bde0b8075d",
            "value": "special_tokens_map.json: 100%"
          }
        },
        "bcff078d112f46e4b1e94c035913e461": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_3e159d3079d64251b1eb001247660aab",
            "max": 446,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_dcc0040b380347d89242290aeab94110",
            "value": 446
          }
        },
        "83782e2b3773487da5e48c1c4726d770": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_cfeb7536c7de4b1eb7f231b1ec9d4ca3",
            "placeholder": "​",
            "style": "IPY_MODEL_8aef0f331a334f45884428705c30ed04",
            "value": " 446/446 [00:00&lt;00:00, 49.6kB/s]"
          }
        },
        "61821b87d18c4f3e938cf47935cf641e": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "359596af0b1846b781e5db6b68cdad7d": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "c9567139ab7d4c1bb3bb41bde0b8075d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "3e159d3079d64251b1eb001247660aab": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "dcc0040b380347d89242290aeab94110": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "cfeb7536c7de4b1eb7f231b1ec9d4ca3": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "8aef0f331a334f45884428705c30ed04": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "ab99a17c79194324ab98bb2c598e6f3d": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HBoxModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HBoxModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HBoxView",
            "box_style": "",
            "children": [
              "IPY_MODEL_24a219884efa4e32ae025153dce6ea93",
              "IPY_MODEL_5faae86c5c3e496f9027402d5e5e5222",
              "IPY_MODEL_7c88bbc032c24cdaafd56bc37281d92f"
            ],
            "layout": "IPY_MODEL_ab211ea896c04775af1e89bcef1353f7"
          }
        },
        "24a219884efa4e32ae025153dce6ea93": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_5fe8063ed6184e4ebeff9436d4bf33c0",
            "placeholder": "​",
            "style": "IPY_MODEL_54af85d50fe040798220437760b34473",
            "value": "chat_template.jinja: "
          }
        },
        "5faae86c5c3e496f9027402d5e5e5222": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "FloatProgressModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "FloatProgressModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "ProgressView",
            "bar_style": "success",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_0710cfef2f394ef989c7c42c99ab686a",
            "max": 1,
            "min": 0,
            "orientation": "horizontal",
            "style": "IPY_MODEL_a6ac3458e86949788a6f6836334ecb8f",
            "value": 1
          }
        },
        "7c88bbc032c24cdaafd56bc37281d92f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "HTMLModel",
          "model_module_version": "1.5.0",
          "state": {
            "_dom_classes": [],
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "HTMLModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/controls",
            "_view_module_version": "1.5.0",
            "_view_name": "HTMLView",
            "description": "",
            "description_tooltip": null,
            "layout": "IPY_MODEL_35c48050669b4c569f5bcdb7319c9e05",
            "placeholder": "​",
            "style": "IPY_MODEL_291825a818954e4390c4961c00bd0394",
            "value": " 15.1k/? [00:00&lt;00:00, 1.37MB/s]"
          }
        },
        "ab211ea896c04775af1e89bcef1353f7": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "5fe8063ed6184e4ebeff9436d4bf33c0": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "54af85d50fe040798220437760b34473": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "0710cfef2f394ef989c7c42c99ab686a": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": "20px"
          }
        },
        "a6ac3458e86949788a6f6836334ecb8f": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "ProgressStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "ProgressStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "bar_color": null,
            "description_width": ""
          }
        },
        "35c48050669b4c569f5bcdb7319c9e05": {
          "model_module": "@jupyter-widgets/base",
          "model_name": "LayoutModel",
          "model_module_version": "1.2.0",
          "state": {
            "_model_module": "@jupyter-widgets/base",
            "_model_module_version": "1.2.0",
            "_model_name": "LayoutModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "LayoutView",
            "align_content": null,
            "align_items": null,
            "align_self": null,
            "border": null,
            "bottom": null,
            "display": null,
            "flex": null,
            "flex_flow": null,
            "grid_area": null,
            "grid_auto_columns": null,
            "grid_auto_flow": null,
            "grid_auto_rows": null,
            "grid_column": null,
            "grid_gap": null,
            "grid_row": null,
            "grid_template_areas": null,
            "grid_template_columns": null,
            "grid_template_rows": null,
            "height": null,
            "justify_content": null,
            "justify_items": null,
            "left": null,
            "margin": null,
            "max_height": null,
            "max_width": null,
            "min_height": null,
            "min_width": null,
            "object_fit": null,
            "object_position": null,
            "order": null,
            "overflow": null,
            "overflow_x": null,
            "overflow_y": null,
            "padding": null,
            "right": null,
            "top": null,
            "visibility": null,
            "width": null
          }
        },
        "291825a818954e4390c4961c00bd0394": {
          "model_module": "@jupyter-widgets/controls",
          "model_name": "DescriptionStyleModel",
          "model_module_version": "1.5.0",
          "state": {
            "_model_module": "@jupyter-widgets/controls",
            "_model_module_version": "1.5.0",
            "_model_name": "DescriptionStyleModel",
            "_view_count": null,
            "_view_module": "@jupyter-widgets/base",
            "_view_module_version": "1.2.0",
            "_view_name": "StyleView",
            "description_width": ""
          }
        },
        "state" : {}
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}